git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Feature request: git status --branch-only
@ 2023-11-14 10:16 Ondra Medek
  2023-11-14 12:28 ` Phillip Wood
  0 siblings, 1 reply; 7+ messages in thread
From: Ondra Medek @ 2023-11-14 10:16 UTC (permalink / raw)
  To: git

Hello,
I am working on a tol which should fetch changes from a remote
repository on a user click. I want to limit fetch on the current
remote tracking branch (something like "origin/master"), but
surprisingly, it's hard to get it for all corner cases like a fresh
clone of an empty repository or detached head, etc. E.g see this SO
thread https://stackoverflow.com/questions/171550/find-out-which-remote-branch-a-local-branch-is-tracking/52896538

The most reliable way for me is to call

git status -b --no-ahead-behind --porcelain=v2

and parse the "# branch.upstream" line output. However, it is a bit
slow on large repos and yields unused output for me. So, I propose a
new switch "git status --branch-only" which would output branch status
only.

Note: workaround is to specify some non-existing directory, like

git status -b --no-ahead-behind --porcelain=v2 .this-dir-does-not-exists

Thanks
Ondra Medek

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-11-16 16:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-14 10:16 Feature request: git status --branch-only Ondra Medek
2023-11-14 12:28 ` Phillip Wood
2023-11-14 12:40   ` Ondra Medek
2023-11-14 15:02     ` Phillip Wood
2023-11-14 19:44       ` Ondra Medek
2023-11-14 20:18       ` Jeff King
2023-11-16 16:09         ` phillip.wood123

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 NNTP newsgroup(s).