Yesterday I was trying to commit from my local repository to the origin. I have to admit, that I am still a beginner in using the sourcetree, so I must be doing something wrong. I have succesfully commited to local master, so the repo is clean already. Currently I am trying to fix a order in my repository branch, since I get a following error when trying to commit to origin. I believe something is not right with my master order:
"Updates were rejected because a pushed branch tip is behind it's remote hint counterpart. Check out this branch and integrate the remote changes hint ( git. pull ) before pushing again. "
Can someone help me ?
Hmm, it looks like you have a disconnected HEAD somehow. I'm going to gues that after Rafal committed some changes to master, you tried to checkout those changes instead of pulling those changes.
In the future, you will get a warning anytime you attempt to checkout a TAG (as opposed to a branch). Until you really understand what that means and whether it is what you want, you should always heed that warning (in other words, don't checkout tags).
To fix your current situation:
1) Try to right-click "master" in the branch list on the left, and select "merge" (make sure that "create a new commit even if fast-forward is possible" is UNchecked).
If SourceTree allows that, try your push again, otherwise comment on this and I'll provide a more complex solution.
You have a bit of a mess there. Your HEAD is not on master, or any other branch.
I would create a new branch pointing at the current HEAD. Then you can checkout master and merge your new branch into it. Then try pushing.
Also, in regards to your first sentence, you don't "commit" to the origin. You commit locally and "push" to the origin. Important distinction.
What exactly is TAG ?
"Hmm, it looks like you have a disconnected HEAD somehow. I'm going to gues that after Rafal committed some changes to master, you tried to checkout those changes instead of pulling those changes."
Seth - Did you mean origin ? I mean each of us has the local repository, which is called master right ? The changes he commited were changes to his local repo. called master ( first ) and then he commited ( pushed his commit ) to remote repository called origin ? Am I correct ?
Unfortunately I was only able to merge the commit. I cannot push to origin.
Finally I ended up with rebuilding the repository from scratch ( deleted the current one and created a new one using the last stable commit available ). Now I will do my best to keep everything clean, nice and tidy.
Thanks 4 help guys!
A tag is just a name for a specific commit. HEAD is a special tag: http://stackoverflow.com/questions/2304087/what-is-head-in-git In terms of master, you've got a major (possibly dangerous) misconception. "master" is not the name of your repository. Your local repository does not have a name for itself, only for remotes. "master" is a BRANCH that exists within your local repo. "origin/master" is a branch that exists on the remote. The Push and Pull operations are designed to keep your local master branch in sync with the origin/master branch. You can not see any of your co-developer's local branches unless you add his local repo as a remote. Next time you are in a situation where your coworker has pushed commits to master, that appropriate way to get them is to checkout your local "master" (never check out HEAD) and either PULL or MERGE. (Pull actually does a fetch and a merge, but assumes that the branch you want to merge from is origin/master).
When you check out any tag or specific commit (including HEAD), you no longer have any branch checked out. If you're just trying to view code, no big deal, but if you commit, you end up with commits that aren't part of any branch. In fact, the situation displayed in the OP's screenshots is EXACTLY what happens in these cases. You can't push or pull (it's not a branch), and if you choose to check out a branch without assigning a tag to your new commit, you'll lose it (technically, the commit is still in the repo, but without a relevant branch or tag, it can be very hard to find without extensive knowledge of the command line git client).
ok, that makes sense. Seems a little weird that checking out HEAD would detach your head if the commit HEAD was pointing to was the tip of a branch (which it normally should be if your HEAD wasn't detached already). But technically it could be the tip of more than one branch, so I guess git couldn't know which branch you meant to be on at that point. And there'd obviously be no reason to checkout HEAD anyway, since HEAD is just a pointer to whatever commit you have checked out.
Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs