mickey24 RSS

mickey24’s Tumblr

Archive

Jul
29th
Wed
permalink
Jun
5th
Fri
permalink
May
29th
Fri
permalink
permalink
permalink
permalink
May
23rd
Sat
permalink
May
22nd
Fri
permalink
May
3rd
Sun
permalink
Apr
24th
Fri
permalink

Why won’t I see changes in the remote repo after “git push”?

The push operation is always about propagating the repository history and updating the refs, and never touches the working tree files. In particular, if you push to update the branch that is checked out in a remote repository the files in the work tree will not be updated.

This is a precautionary design decision. The remote repository’s work tree may have local changes, and there is no way for you, who are pushing into the remote repository, to resolve conflicts between the changes you are pushing and the ones in the work tree. However, you can easily make a post-update hook to update the working copy of the checked out branch. The reason for not making this a default example hook is that they only notify the person doing the pushing if there was a problem. The latest draft post-update hook for this is at http://utsl.gen.nz/git/post-update, which deals with almost all cases, apart from where there is already a conflicted merge on the remote side (as git-stash cannot currently stash this). It also fails to work in instances where it could, such as none of the files are actually conflicting.

A quick rule of thumb is to never push into a repository that has a work tree attached to it, until you know what you are doing.

If you are sure what you are doing, you can do a “git reset —hard” on the side you pushed to. Note that this WILL lose ALL changes you made on that side, resetting the working tree to the newest revision you pushed.

See also the entry (How would I use “git push” to sync out of a firewalled host?) in this FAQ for the proper way to work with push with a repository with a work tree.