I have a scenario in which there a several remote tracking branches within my local repository that I must sync up to. Our workflow model is:
I've noticed that "git status" doesn't show me what branch my local branch is based on unless something has changed; i.e. uncommitted local changes or a recent fetch puts my local branch behind the times. Is there some way of knowing what branch my local branch is based on without having to change things? Something like, "git status -showparentbranch" or some other command that would show this. Occasionally I run into this need but don't know yet how to satisfy it.
There is a command that gives you about all tracking branches. And to know about the pull and push configuration per branch you can use the command git remote show origin. and you can use -sb option for seeing the upstream. Hope this information will help you to find which branch is tracking.
To view your remote branches, simply pass the -r flag to the git branch command. You can inspect remote branches with the usual git checkout and git log commands. If you approve the changes a remote branch contains, you can merge it into a local branch with a normal git merge .
Parent Branch means the main branch from where the Additional Profile is trading.
First, you can use the "git log --graph --all" option (potentially with "--pretty=format:...") and visually trace back a branch to see what commit it branched from (also referred to as an Ancestor Commit) and then (assuming the history is easy enough to read/understand) trace back up to find out which branch that ...
try this:
git log --graph --decorate
Git does not track what branches a commit was put through. There is no way to tell. If the commits happened on your repo, then you can inspect the reflog, but that's about it. Take a look at the explanation of the DAG in the Pro Git book - also read up on reflog in there.
You can also visualize history better with gitk --all
or git log --graph --decorate
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With