From: Jeff King Date: Tue, 02 Apr 2013 17:51:13 GMT Subject: Re: [BUG] inconsistent behavior with --set-upstream vs --set-upstream-to Message-ID: <20130402175113.GD24698@sigill.intra.peff.net> In-Reply-To: On Tue, Apr 02, 2013 at 10:30:35AM -0700, Garrett Cooper wrote: > I push the branch to origin/ and then things tend to work, but since I > obviously had been doing things wrong what's the correct order of > operations for creating a branch and setting the upstream > appropriately? Once you have pushed it, the push creates the refs/remotes/origin/foo tracking branch automatically. You are then free to reference it wherever you like, including in set-upstream-to. However, you can also just ask push to do it for you with "--set-upstream" or "-u". So the workflow is something like: $ git checkout -b my-topic $ hack hack hack $ git commit -m "looking good, time to publish" $ git push -u origin HEAD > PS I love git as a tool, but I really wish the workflows were simpler > or more straightforward, and error messages were clearer. It seems > like this would help prevent usage errors like this.. Things slowly improve as people make suggestions. I think the thing that might have helped here is better advice when "set-upstream-to" is pointed to a ref that does not exist. Patches coming in a minute. -Peff