1

The case is pretty simple, I work in branchA and wish to see if there new commits in branchB. And branchA and branchB are completelly different, separated branches, I need neither merge nor pull anything, just to find out if it has new commits or it doesn't. I can pretty simple do it with source tree git client, but I wish to find out how do I check it with git console.

git fetch origin gives me no information about it:

git fetch origin branchB
From https://github.com/user_name/repo_name
 * branch            offline-mode -> FETCH_HEAD

How do I check if there are new commits in another branch without switching branches?

mr_blond
  • 1,586
  • 2
  • 20
  • 52
  • After fetching, just run `gitk --all` or `git log --graph --all --oneline --decorate`. – choroba Nov 01 '18 at 19:56
  • I believe that when doing `git fetch` the output will show you whether `branchB` were updated or not. In any case, if you want to update `branchA` with `branchB`, you can always just try something like rebasing. If no new commits have come in, nothing would happen anyway. – Tim Biegeleisen Nov 01 '18 at 19:56
  • Possible duplicate of [Check if pull needed in Git](https://stackoverflow.com/questions/3258243/check-if-pull-needed-in-git) – phd Nov 02 '18 at 22:21
  • https://stackoverflow.com/search?q=%5Bgit%5D+fetch+different+branch – phd Nov 02 '18 at 22:21

1 Answers1

2

After doing git fetch to update your local branches, you can see the state of all your branches with git branch -vv. This will list all of your branches along with the remote branch that they are tracked to. It will also say if the branch is ahead or behind the remote.

Schleis
  • 41,516
  • 7
  • 68
  • 87