Git merge - git - exclude commits when rebasing

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I have recently merged a feature that was not ready to go into master. Without realizing it I rebased the bad master into another branch that was good.

But now I am not sure how to pull those bad commits out of my other story.

HERE is my git log file

commit 15bb0d630f9b9cf59axxxxxxx8100d3a7302
Author: Moises Zaragoza <mZaragoza@xxxx.com>
Date:   Mon Jun 1 11:45:31 2015 -0400

    Some updates 


commit 3caf183afe3f5d7dcfxxxxxxxa239d44c8dfd11a
Author: Moises Zaragoza <mZaragoza@xxxx.com>
Date:   Mon Jun 1 11:45:31 2015 -0400

    Some updates 

commit 3c6c81c7a3215fcdxxxxxxxb56a5540745c397
Author: Moises Zaragoza <mZaragoza@xxxx.com>
Date:   Wed Jun 3 16:59:31 2015 -0400

    Bad Commit that should not be here 

Answers

if you haven t pushed your code yet, you can do an interractive rebase and delete commits :

git rebase --interractive 3c6c81c7a3215fcdxxxxxxxb56a5540745c397^

You will end up with an editor with commit history:

3c6c81c7a3215fcdxxxxxxxb56a5540745c397 Bad Commit that should not be here
3caf183afe3f5d7dcfxxxxxxxa239d44c8dfd11a Some updates 
15bb0d630f9b9cf59axxxxxxx8100d3a7302 Some updates 

If you want to delete commit 3c6c81c7a3215fcdxxxxxxxb56a5540745c397, just delete this line in the interractive rebase and save:

3caf183afe3f5d7dcfxxxxxxxa239d44c8dfd11a Some updates 
15bb0d630f9b9cf59axxxxxxx8100d3a7302 Some updates 

http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/30646616/git-exclude-commits-when-rebasing

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils