git - How to know which commit belongs to which branch -
when use git log --graph (or alias it) how can tell commit (*) belongs branch?
here's gitconfig
tree = log --graph --abbrev-commit --decorate --date=relative --format=format:'%c(boldblue)%h%c(reset) - %c(bold green)(%ar)%c(reset) %c(black)%s%c(reset)%c(dim black)- %an%c(reset)%c(bold yellow)%d%c(reset)' --all any rock!
update ended using: git log --all --graph --format=format:'%c(bold blue)%h%c(reset) %c(dim black)%s%c(reset)%c(bold red)%d%c(reset) %c(green)by %an, %ar%c(reset)'
i use git log --all --graph --oneline --decorate.
git rearranges graph make commits show merges coming in right toward left. can tell what's branch, , it's merging because of this, when starts twisty. here's example snippet 1 of repos, output above log command:
| * af8bb24 remove mayaaxis.py | * 39b27d7 remove axis.py |/ * a12c712 merge branch 'mayaobject' |\ | * 755c024 elide pymel.core.animation import in core.py | * 6de87c2 clean imports in core.py | * 4b70adf move core.refgrid new grid.py | * 40d3c7d merge branch 'absorbmayaref' mayaobject | |\ | | * 58305e5 add core.mayaobject test reffile property | | * 154af30 refactor core.mayaobject refpath reffile | | * d23fe77 condense namespace work in core.mayaref.loadref | | * 22c780b add missing test core.mayaref namespace arg | |/ | * 6843970 remove projpath arg core.mayaref constructor | * 692578a add docstrings core.mayaobject test classes | * acb4d75 add core.mayaobject init defaults test | * b8f1ae6 stub in core.mayaobject |/ * 4dc6112 make __init__.py imports relative * abde256 add *.swp, , *.swo .gitignore note a12c712 commit near top - that's merge of former 'mayaobject' branch, started near bottom @ 4dc6112 commit. can see branch off right @ bottom, , merge in left near top. first commit on 'mayaobject' branch b8f1ae6, forks off right - branching goes off right, merging comes in toward left.
you can see while on 'mayaobject' branch, decided jump off again , work on 'absorbmayaref' branch, forked off of 6843970, , it's first commit 22c780b. merged 'mayaobject' @ 40d3c7d, , 'mayaobject' - stated @ beginning - merged master branch @ a12c712.
leave auto-generated merge commit messages (e.g. "merge branch 'absorbmayaref' mayaobject") intact, , you'll able tell belonged branch. if delete or overwrite messages when making merge commits, not able tell on branch.
i make clear in commits touched, because it's small change in 1 file. note how 4 commits 22c780b 58305e5, inclusive, mention 'core.mayaref' or 'core.mayaobject'. if didn't have 40d3c7d merge telling me 'absorbmayaref' branch, i'd still able see pretty that feature branch had in core module, , 2 classes in particular. when changes touch bunch of files, try make clear, , note in general happened in change, e.g. "refactor path names across library", or "reorganize tests in several test files".
Comments
Post a Comment