In the git history, I have a branch with 5 file changes. On each change has it's own commit, this means I end up having 5 commit's.
What is the best way to take out the second and fourth commit?
In the git history, I have a branch with 5 file changes. On each change has it's own commit, this means I end up having 5 commit's.
What is the best way to take out the second and fourth commit?
Run git rebase -i HEAD^6
. This will show a list of the last five commits along with their messages. Delete the lines with the commits that you don't want, save and quit the editor.
You may have some conflicts to resolve, but when you are done, your branch will contain three of the five commits.