Last active
August 29, 2015 14:16
-
-
Save mparker17/6676029d32fb4973a5b5 to your computer and use it in GitHub Desktop.
Listing only commits in merged and unmerged branches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEFORE a branch has been merged in, you can: | |
* list all commits that make up that branch with: | |
git log | |
* list all commits in that branch, excluding commits merged in, with: | |
git log master..feature2a | |
git log master..feature2a --first-parent | |
* list all commits in that branch, excluding commits merged in AND merge commits with: | |
git log master..feature2a --first-parent --no-merges | |
AFTER a branch has been merged in, you can list only the commits specific to that branch with: | |
1. find the commit hash of the commit where the branch was merged in, e.g.: 1aaff8c | |
2. git log 1aaff8c~1...feature2a | |
^^ Don't forget this ~1! | |
To revert a branch after it has been merged in: | |
1. git diff 1aaff8c~1...hop-111-new-client-relationship > patchfile.patch | |
2. git apply -3 -R patchfile.patch | |
3. Resolve any merge conflicts | |
4. Commit. | |
*** | |
See also http://stackoverflow.com/a/463027 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment