Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Comments on Get notified when there are unmerged changes from origin

Post

Get notified when there are unmerged changes from origin

+4
−0

Sometimes I work with Git repos that have some changes fetched but not yet merged to the local branch. Occasionally I make commits without noticing this, which necessitates rebase/conflict resolution.

I would like to be notified when I'm working with a Git repository such as this. Is there a way to configure either Git or my shell (fish) to automatically print a message like below?

Warning: Local branch is not even with upstream, merge changes to rectify.

It doesn't have to be a message, just any reasonable way of notifying me will do.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

git log --all --graph --oneline (1 comment)
git log --all --graph --oneline
alx‭ wrote 4 months ago

Not an answer, but rather a different approach: visualizing the tree.

After I do git-fetch(1), I usually print the log, to see how exactly the upstream differs from me:

$ git log --oneline --graph main neomutt/main -5
* ef540729d (neomutt/main) Remove unused declaration (#4343)
* accac212a ignore macro events in mw_yesorno()
* 23578d66b Fix '&&' within '||' warning (#4340)
| * 3b2e17a26 (HEAD -> main) mutt/memory.[ch]: Add mutt_mem_reallocarray()
|/  
* f10c0f0dd Fix function pointer types (#4337)

Here it's obvious that I need to rebase. If there aren't many branches, you can use --all instead of specifying the branches.

I have some aliases for this in my ~/.gitconfig:

[alias]
	lgo = log --graph --oneline --abbrev=12
	lago = lgo --all

So I usually run git lago after git fetch origin.