int3
int3

Reputation: 13201

Git: Ignoring certain commits when pushing

I'd like to have some modifications that are private to my fork. How do I go about doing this?

There's a question here about pushing a single commit, and the answer is to cherry-pick the commits you want to push from a private branch and put them on the main branch. However, I would like something more along the lines of ignoring a certain commit when pushing.

Upvotes: 5

Views: 254

Answers (2)

Zepplock
Zepplock

Reputation: 29175

why not make a fork of the main branch and ask the owner of that branch to make a pull? Kind of like github style?

Upvotes: 0

VonC
VonC

Reputation: 1329582

If those commits are part of commits not yet pushed, you can:

  • reoder them (rebase --interactive) to put them as the most recent commits
    (actually, if they are sequential, you can rebase --onto another branch altogether)
  • make a branch "private" to mark the tip if the current "dev" branch
  • reset that dev branch to the last commit before those private ones
  • push dev branch.

So the solution still involves a "private" branch in the process, but more importantly it is about isolating (hence the branch) the part of history which is not made to be published, ending up with a clearer "public" history for you to publish (push).

Upvotes: 2

Related Questions