On Monday, May 7, 2012 10:09:29 AM UTC-7, Tom Roche wrote:
> How to just overwrite managed files in an existing directory with the 
> latest versions from a remote branch/repo, without merging or 
> whack-n-clone? What I mean: 
> As previously noted 
> https://groups.google.com/forum/?fromgroups#!topic/git-users/kjNzSHA12bI 
> I'm attempting to shepherd a group from CVS to git. I'm starting with a 
> small subgroup of early-adopter types, who mostly seem enthused. One 
> problem we're having relates to how our workspaces are configured, about 
> which we have little control. We have separate clusters on which we operate 
> depending on job and availability. So it is often the case that a developer 
> will be making changes in a working folder on one cluster for one job, then 
> want to bring origin/master into a working folder on another cluster. 
> The early adopters don't like the solutions that are obvious to me: 
> 1 Pull and merge: they usually don't wanna hafta merge, just to overwrite 
> local files with the "latest-n-greatest." 

So they're ok with losing their changes?  If they don't have any changes 
then the "merge" is trivial and doesn't even actually create a merge commit.

> 2 "Whack and clone": i.e. 
> cd .. 
> rm -fr foo/ 
> git clone remote...foo.git 
>   They don't like this, because they usually have non-managed, 
> .gitignore'd in the working directory, which must be saved and then 
> restored. 
> I'm wondering: is there another way to do this? 
git fetch origin
git reset --hard origin/master

DON'T use `reset` if there's anything in the local branch history that you 
don't want to lose.  `reset` affects the history of the current branch, not 
just the working files.

If you want to revert files to the state then were in when they were last 
checked in locally, use:

git checkout .

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To view this discussion on the web visit 
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to