git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Using the --track option when creating a branch

From
Marc Branchaud <marcnarc@xiplink.com>
Date
Oct 30, 2008, 19:13 UTC
Message-ID
<490A0770.5060600@xiplink.com>
In-Reply-To
<18697.54743.601331.133842@lisa.zopyra.com>
Bill Lear wrote:
Show 6 quoted lines
> 
> the reason being that every manual our users read says "use git push",
> use "git pull", the examples being written for 'master' branch usage,
> and people just assume that 'git push'/'git pull' are smart enough to
> know which branch you are on and do the same logical thing as a bare
> 'git push'/'git pull' does when on master.

I agree that this is a 'gotcha' for git-push. I'm a new git user, and I've been experimenting with git and reading the documentation for the last few weeks. But I would not have known about this behavior if it weren't for this thread.

Yes, push's man page is clear about what happens if you push with no refspec, and the fetch & pull man pages both have an obscure note to "never do your own development on branches that appear on the right hand side of a <refspec> colon on 'Pull:' lines". But still the behavior is not what I expected. Before I read this thread, I missed the implications of what those parts of the man pages were saying.

One could call this a failure of the documentation (man pages and beyond). Personally, though, I tend to expect minimal commands to do minimal things. So a plain "git push" would do the minimum amount of pushing, and if I want it to do more I'd add extra parameters to the command.

The current behavior seems fairly harmless if you always follow the pattern of creating topic branches for all your work. But git (rightly) doesn't enforce that pattern, and so I think push shouldn't default to doing something potentially harmful just because you forgot to create a topic branch one day. (Or maybe you decided to be clever and give one of your local branches the same name as a remote's branch...)

		Marc
Previous: Bill LearNext: Sam Vilain
Message 18 of 23 in “Using the --track option when creating a branch”
  1. Bill LearOct 29, 2008
  2. Santi BéjarOct 29, 2008
  3. Bill LearOct 29, 2008
  4. Sam VilainOct 30, 2008
  5. Bill LearOct 30, 2008
  6. Bill LearOct 30, 2008
  7. Andreas EricssonOct 30, 2008
  8. Samuel TardieuOct 30, 2008
  9. Andreas EricssonOct 30, 2008
  10. Samuel TardieuOct 30, 2008
  11. Pierre HabouzitOct 30, 2008
  12. Samuel TardieuOct 30, 2008
  13. Sam VilainOct 30, 2008
  14. Andreas EricssonOct 30, 2008
  15. Samuel TardieuOct 30, 2008
  16. Andreas EricssonOct 30, 2008
  17. Bill LearOct 30, 2008
  18. Marc BranchaudOct 30, 2008
  19. Sam VilainOct 30, 2008
  20. Jakub NarebskiOct 30, 2008
  21. Jeff KingNov 2, 2008
  22. Sam VilainOct 30, 2008
  23. Santi BéjarOct 30, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.