Reputation: 1063
After merging one branch into another, (like develop into master) with
git merge --no-ff develop
If you execute the git command git status
in a terminal just after you will see:
On branch master
Your branch is ahead of 'origin/master' by 1 commits.
(use "git push" to publish your local commit)
nothing to commit, working tree clean
Which is not much different from that (if we look without paying attention):
On branch master
nothing to commit, working tree clean
Sometimes I do not pay much attention and I forget to push. So is there an command to know if we must push? or a way to color the Your branch is ahead of 'origin/master' by 1 commits.
part in red?
or may be just a command that return 0 or 1 if we need to push, if yes I could include it with an echo
routine in a git alias to make my git status
more explicit.
Upvotes: 1
Views: 509
Reputation: 1063
Finally, I resolved it by putting this in my ~/.gitconfig
:
[alias]
st = "!f() { git status -u; \
git status -u | grep \"Your branch is ahead\" > /dev/null \
&& echo \"\\e[31m[WARNING]\\e[91m You need to push :)\"; }; f"
Like that just by performing git st
I will be warned by a red message if I need to push.
Upvotes: 1