Git: List the branches for merge in progress -


my team programs in labview, stores of it's source code in binary files. means when "merging" 99% of time you're selection file merge base, or branch.

i'd make visual tool (source tree little pokey in situation). ui run bunch of following commands:

git checkout --ours ... git checkout --theirs .... 

my question: there way nice user friendly branch name corresponds "ours" , "theirs"?

the ours branch branch on when started merge, say, whatever head names. (this assumes head names branch, i.e., not on special anonymous "detached head" branch when start merge.)

to symbolic name of current branch:

git symbolic-ref head 

this prints full name (refs/heads/master) standard output , exits success (zero) status, or prints fatal: ... message stderr , exits failure (nonzero) status. add -q suppress failure messages; add --short suppress refs/heads/ part output on success.

the name(s), if any, of other branch(es) being merged is/are bit more difficult. git translates arguments raw sha-1 hash ids on. however, also stores names, if there some, in .git/merge_msg:

$ cat .git/merge_msg merge branch 'branchb' brancha $  

by reading , parsing file (note: can locate .git directory git rev-parse --git-dir, add /merge_msg, path file) can find branch name, if there one. note file's format (and indeed existence) not officially documented anywhere, prepared change; has been there since relatively days, unchanged long time.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -