Warning updating the currently checked out branch

When you instead choose to check out a , Git won't do this for you.The consequence is that when you make changes and commit them, these changes do NOT belong to any branch. Total 3 (delta 0), reused 0 (delta 0) remote: error: refusing to update checked out branch: refs/heads/master remote: error: By default, updating the current branch in a non-bare repository remote: error: is denied, because it will make the index and work tree inconsistent remote: error: with what you pushed, and will require 'git reset --hard' to match remote: error: the work tree to HEAD. Writing objects: 100% (3/3), 334 bytes | 0 bytes/s, done."You can't push to a non-bare repository, else everything gets out of sync.""What do you mean bare? Klaus smiled and his head appeared over the cubicle. In Git, if you want to push changes back to a repository, instead of pulling them, the repository that you push to should be what is called a As mentioned, pushing to a non-bare repository is not a good idea. We are really only worried about pushing to a branch which is currently checked out."Come over here genius and I'll show you," he said with the slightest amount of gloat at being one of the only people to know something about Git that Rob didn't. When you push to a repository, you update the objects in the objects database. Pushing to a non-bare repository will mean that the index will get changed, as it should reflect what the branch looks like at HEAD.However, if you do one day, you'd probably like to know what a "detached HEAD" is - and how you might have arrived at that state.With the "git checkout" command, you determine which revision of your project you want to work on.

Normally, you use a The HEAD pointer in Git determines your current working revision (and thereby the files that are placed in your project's working directory).

remote: error: refusing to update checked out branch: refs/heads/master remote: error: By default, updating the current branch in a non-bare repository remote: error: is denied, because it will make the index and work tree inconsistent remote: error: with what you pushed, and will require 'git reset --hard' to match remote: error: the work tree to HEAD.

remote: error: remote: error: You can set 'Current Branch' configuration variable to remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into remote: error: its current branch; however, this is not recommended unless you remote: error: arranged to update its work tree to match what you pushed in some remote: error: other way.

Now if you want to push everything back to the central repository, you can’t just use a plain push.

remote: error: remote: error: You can set 'Current Branch' configuration variable to remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into remote: error: its current branch; however, this is not recommended unless you remote: error: arranged to update its work tree to match what you pushed in some remote: error: other way.

309

Leave a Reply