Is it possible to exclude specific commits when doing a git merge?

Create a new branch, rebase the branch interactively and drop commits you don't want, and then merge that.

Create a new branch, rebase the branch interactively and drop commits you don't want, and then merge that. You can't take changes out of the middle of a branch without rehashing, but the right thing will happen when it sees the same changes in a later merge (e.g. From cherry-picking and what-not).

I see no way how I can "drop" the unwanted commits – Henning Jun 8 at 11:37 @Henning when you git rebase -i other-branch it gives you a text editor with a bunch of commits in it. Delete the lines you don't want. – Dustin Jun 9 at 0:14.

I've found a solution that works for me at progit.org/book/ch7-2.html#merge_strategies Let's say you want to exclude the file config. Php On branch A: Create a file named '. Gitattributes' in the same dir, with this line: config.

Php merge=ours. This tells git what strategy to use when mergin the file. In this case it always keep your version, ie.

The version on the branch you are merging into. Add the . Gitattributes file and commit On branch B: repeat steps 1-2 Try merging now.

Your file should be left untouched.

Interesting... thanks – sehe Mar 14 at 11:33 For future readers, this works great for explicitly not including specific files. (In my case, I'm deploying different branches to different servers and want to keep my Capistrano deploy script unique on each branch. ) – charliepark May 13 at 12:08.

The reason why this can't be done directly is that every commit contains links to the parent commits (typically just one but several for merges). That way if you have one commit (by its SHA1 sum) the whole history is also fixed as the parents also contain links to their parents and so on. So the only way to leave out patches in the history is to write a new one.

Git rebase -i on a newly created branch is probably the easiest way of achieving that.

If you only want to exclude some commits that are at the end, you can just commit to a specific commit number: git checkout partlyMergedFrom git whatchanged --> find the commit hash up to where you want to merge git checkout partlyMergedInto git merge e40a0e384f58409fe3c864c655a8d252b6422bfc git whatchanged --> check that you really got all the changes you want to have.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions