maybe
Code: Select all
git rev-list --count master...origin/master
maybe
Code: Select all
git rev-list --count master...origin/master
Ah that's probably a better option, in my testing after resetting to a prior commit I do get the info by running
Code: Select all
git status --ahead-behind
Code: Select all
On branch master
Your branch is behind 'origin/master' by 2 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
nothing to commit, working tree clean
Code: Select all
chennes@chrismaclaptop 3DfindIT % git reset --hard b9ab38a
HEAD is now at b9ab38a Make sure to execute javascript from the main thread.
chennes@chrismaclaptop 3DfindIT % git status --ahead-behind
On branch master
nothing to commit, working tree clean
Code: Select all
chennes@chrismaclaptop 3DfindIT % git rev-list --count master...origin/master
fatal: ambiguous argument 'master...origin/master': unknown revision or path not in the working tree.
Code: Select all
adrian@DESKTOP-PAKQOHR:~$ git clone https://github.com/cadenasgmbh/3dfindit-freecad-integration
Cloning into '3dfindit-freecad-integration'...
remote: Enumerating objects: 149, done.
remote: Counting objects: 100% (149/149), done.
remote: Compressing objects: 100% (101/101), done.
remote: Total 149 (delta 75), reused 89 (delta 33), pack-reused 0
Receiving objects: 100% (149/149), 338.65 KiB | 281.00 KiB/s, done.
Resolving deltas: 100% (75/75), done.
adrian@DESKTOP-PAKQOHR:~$ cd 3dfindit-freecad-integration/
adrian@DESKTOP-PAKQOHR:~/3dfindit-freecad-integration$ git reset --hard b9ab38a
HEAD is now at b9ab38a Make sure to execute javascript from the main thread.
adrian@DESKTOP-PAKQOHR:~/3dfindit-freecad-integration$ git status --ahead-behind
On branch master
Your branch is behind 'origin/master' by 6 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
nothing to commit, working tree clean
adrian@DESKTOP-PAKQOHR:~/3dfindit-freecad-integration$
this suggests the remote is not called origin in your clone though, what's the output offatal: ambiguous argument 'master...origin/master': unknown revision or path not in the working tree.
Code: Select all
git status -sb --porcelain
## master...origin/master [behind 6]
adrianinsaval wrote: ↑Wed Aug 10, 2022 3:30 pmthis could be easier to parse, here it gives:Code: Select all
git status -sb --porcelain
It works beautifully on my Windows machine, but on the Mac I just get "##master" -- I wonder if there's something wrong with git version 2.32.1 (Apple Git-133).## master...origin/master [behind 6]
Code: Select all
git branch -a
Code: Select all
* master