I'm trying to figure out whether I can pull.
If my branch is based on a remote branch than he has remote tracking branch, so I can pull.
If my branch is based on a commit, it doesn't have a remote tracking branch thus pull would fail.
What I managed to find is that when using the command git branch -vv:
- If there's a remote tracking it will be shown in square brackets. Example:
* origin/before-yo b0b97cf [remotes/origin/before-yo] Move to subfolder - If the branch is based on a commit, there won't be any remote ref indication. Example:
* 2fbe2ab473fe8f7aea2a36642aea1dc7d36add51 2fbe2ab Advance counter
Is there a better way to understand if there's a remote tracking branch connected to my current working branch?
Also, might git branch -vv not work in some cases?
Thanks.
Here's a script which shows what you really want: after
git fetch, it shows the difference between local and remote branches, thus you will know what you have to do (pull,push,rebase, etc.). Put the directory of it to somewhere on your PATH and you can use it asgit fetch-log.https://gitlab.com/bimlas/home/blob/3fb207cdfe57593a78abe30150a3bc40b242e26a/linux/home/.gitconfig_files/custom_commands/git-fetch-log