Reputation: 1011
I have read git-scm.com/book and some questions on StackOverflow that have already been answered, but still have one question I don't get the answer for. Here is the use case:
Locally, I have cloned a remote repository (get clone). The repository is a rather big, thousands of nested folders and files. I work with files in this repository. Some of them are modified. Some others are deleted. Also, some files are added. After I'm done with those changes, I don't want to save them in my local repository (git add, git commit) and push/merge them to/with the remote ones (git push). All I want is the following:
a) files changed locally are being replaced by corresponding files from the remote repository (all conflicts are ignored, remote file versions have higher priority);
b) files missing locally are being copied from the remote repository;
c) newly created files that exist locally but don't exist remotely remain untouched.
Question: with which set of Git commands am I able to get it done?
Thanks, Racoon
Upvotes: 2
Views: 884
Reputation: 1082
This should do it:
git reset --hard
git clean -df
The first command resets all tracked files, the second one removes untracked files. Note that this does not touch ignored files. Add -x
to also remove ignored files.
Upvotes: 2