views:

39

answers:

1

I've been doing a workflow of making a git repository on a remote central repository, cloning that repo on my local dev machine, doing some work, and then pushing the changes back to the same repo on the remote server.

However, and I believe this was after an update I did to git recently, after pushing up a change, I'm getting the following warning:

 Counting objects: 2724, done.
 Delta compression using up to 2 threads.
 Compressing objects: 100% (2666/2666), done.
 Writing objects: 100% (2723/2723), 5.90 MiB | 313 KiB/s, done.
 Total 2723 (delta 219), reused 0 (delta 0)
 warning: updating the currently checked out branch; this may cause confusion,
 as the index and working tree do not reflect changes that are now in HEAD.

Can someone explain to me exactly what this warning means, and what I'm doing wrong in my workflow to not receive this warning?

+1  A: 

Git has two types of repositories. One is your regular repo which you check out. The other is a "bare repo". The former contains a working copy of your code along with a .git directory that hosts the history. You can clone from such a repository but if you try to push back into it, it's quite possible that the state of the project inside the .git directory becomes out of sync with the index (staging area) and the working copy on the repository.

This is the warning you're seeing. The way to fix it would be to make your "remote central repository" a bare repo. You can do this using git init --bare. If you do this, you can't use this as a work area. It can only be used as a remote. Now you can push to this and pull from it but can't work directly over there.

Noufal Ibrahim
Ah, ok I'll give it a try. I won't need to work on the remote repo directly, so this sounds like exactly what I should be doing.
japancheese