For a branch named xyzzy, this would be the typical correct setting. If you run git branch -set-upstream-to=origin/xyzzy, that sets the current branch's upstream to origin/xyzzy. (Do feel free to ignore the message-it's not a error after all-if you don't find it useful.) But this message is meant to be useful, so you probably shouldn't just remove the upstream as a way to make it stop happening. With no upstream, this stops the message about being ahead or behind or diverged. If you use -unset-upstream, this removes the current branch's upstream. 2 Whatever branch you checked out, that's the one you're on. You choose this branch with git checkout or-since Git 2.23- git switch. The current branch is the one you are on, when git status says on branch xyzzy or whatever it is it says. These -set-upstream-to and -unset-upstream affect the current branch. We also have git branch -set-upstream-to and git branch -unset-upstream for setting, or clearing, an upstream. Old versions of Git were not very consistent about calling this an upstream setting, but in modern Git, it's more consistent. Each of your own local branches, in your own Git repository, can have one setting that Git calls an upstream. This claim is actually just a bit too strong. First, each (local) branch has an upstream setting To properly answer the question, we need to break it up into pieces. The this in question is the fact that after git push origin master, the OP runs git status and sees the message On branch master followed by Your branch is ahead of 'origin/master' by 1 commit. See the longer sections below for what it does. It was much more necessary before Git version 1.8.2 came out that Git was released three years after the original question.ġThe -p or -prune option is not required and is suggested only parenthetically in the linked answer. The existing accepted answer suggests running git fetch -p, 1 which is a good idea, although less-often required these days. It seems worth adding a modern answer along with explainers, though. It was posted three years before the first release of a version of Git that fixed many of these problems. Note: this particular question is, at the time I write this answer, quite old. Nothing to commit (working directory clean) # Your branch is ahead of 'origin/master' by 1 commit. Not ones that I can see, maybe there is some funny config going on on my end? $ git status That is what I thought, I figured that I would make sure my understanding of it was correct.Īre you passing some extra arguments to it? It doesn't actually check the remote repo I am pushing to GitHub and pulling to whichever computer I happen to be working on at that point in time, my local copy is always fully up to date as I am the only one working on it. Where do you push/pull the current branch Including what branch is printed in the message git folders)? git pull seems to 'fix' this strange message, but I am still curious why it happens, maybe I am using git wrong? Is it because when you push the code it doesn't actually update your locally cached files (in the. Then when I do a git status it tells me that my branch is ahead by X commits (presumably the same number of commits that I have made). I am working in one repo by myself at the moment, so this is my workflow:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |