* [RFC] git subcommand to check if branch is up-to-date with upstream
@ 2016-07-25 12:58 Sidhant Sharma
2016-07-25 16:58 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Sidhant Sharma @ 2016-07-25 12:58 UTC (permalink / raw)
To: Git Mailing List
Hi,
I was wondering if it would be a good idea to have a command to check if a
push or pull is required. Perhaps it can also suggest if changes are
fast-forward or the branches (local and remote) have diverged.
The reason I feel the need of such a command is when I need to check if my
branch is up-to-date with the remote, and when I need to know if my local
has diverged. Currently I use a script based on this stackoverflow answer[1]
Not an extremely useful tool, but I thought it'll be good to have it.
Warm regards,
Sidhant Sharma
[1] http://stackoverflow.com/a/3278427/5211579
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] git subcommand to check if branch is up-to-date with upstream
2016-07-25 12:58 [RFC] git subcommand to check if branch is up-to-date with upstream Sidhant Sharma
@ 2016-07-25 16:58 ` Junio C Hamano
2016-07-25 17:33 ` Jakub Narębski
0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2016-07-25 16:58 UTC (permalink / raw)
To: Sidhant Sharma; +Cc: Git Mailing List
Sidhant Sharma <tigerkid001@gmail.com> writes:
> I was wondering if it would be a good idea to have a command to check if a
> push or pull is required. Perhaps it can also suggest if changes are
> fast-forward or the branches (local and remote) have diverged.
Doesn't "branch -v" give that information these days? You'd need to
"fetch" first to get the up-to-date worldview before running it, of
course.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] git subcommand to check if branch is up-to-date with upstream
2016-07-25 16:58 ` Junio C Hamano
@ 2016-07-25 17:33 ` Jakub Narębski
2016-07-26 9:32 ` Sidhant Sharma
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Narębski @ 2016-07-25 17:33 UTC (permalink / raw)
To: Junio C Hamano, Sidhant Sharma; +Cc: Git Mailing List
W dniu 2016-07-25 o 18:58, Junio C Hamano pisze:
> Sidhant Sharma <tigerkid001@gmail.com> writes:
>
>> I was wondering if it would be a good idea to have a command to check if a
>> push or pull is required. Perhaps it can also suggest if changes are
>> fast-forward or the branches (local and remote) have diverged.
>
> Doesn't "branch -v" give that information these days? You'd need to
> "fetch" first to get the up-to-date worldview before running it, of
> course.
You need "branch -v -v". For current branch, you can simply run "git checkout".
All this is the information for end user, not scripts.
$ git branch -v -v
* gitweb-docs 4ebf58d [origin/master: ahead 1] gitweb(1): Document query parameters
master 08bb350 [origin/master] Sixth batch of topics for 2.10
$ git checkout
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
--
Jakub Narębski
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] git subcommand to check if branch is up-to-date with upstream
2016-07-25 17:33 ` Jakub Narębski
@ 2016-07-26 9:32 ` Sidhant Sharma
0 siblings, 0 replies; 4+ messages in thread
From: Sidhant Sharma @ 2016-07-26 9:32 UTC (permalink / raw)
To: Jakub Narębski; +Cc: git Mailing List
On Monday 25 July 2016 11:03 PM, Jakub Narębski wrote:
> W dniu 2016-07-25 o 18:58, Junio C Hamano pisze:
>> Sidhant Sharma <tigerkid001@gmail.com> writes:
>>
>>> I was wondering if it would be a good idea to have a command to check if a
>>> push or pull is required. Perhaps it can also suggest if changes are
>>> fast-forward or the branches (local and remote) have diverged.
>> Doesn't "branch -v" give that information these days? You'd need to
>> "fetch" first to get the up-to-date worldview before running it, of
>> course.
> You need "branch -v -v". For current branch, you can simply run "git checkout".
> All this is the information for end user, not scripts.
>
> $ git branch -v -v
> * gitweb-docs 4ebf58d [origin/master: ahead 1] gitweb(1): Document query parameters
> master 08bb350 [origin/master] Sixth batch of topics for 2.10
>
> $ git checkout
> Your branch is ahead of 'origin/master' by 1 commit.
> (use "git push" to publish your local commits)
>
Nice, didn't know that one. Thanks for the tip.
Regards,
Sidhant Sharma
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-26 9:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-25 12:58 [RFC] git subcommand to check if branch is up-to-date with upstream Sidhant Sharma
2016-07-25 16:58 ` Junio C Hamano
2016-07-25 17:33 ` Jakub Narębski
2016-07-26 9:32 ` Sidhant Sharma
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).