Reputation: 1201
I am new to git.So please forgive for basic question.
I have couple of checkouts of repos: Folder1
is on Server1
and Folder2
is on Server2
.
Folder2
only "git pull
" changes.
This fetches all files which is checked-in from Folder1.
I want to update only specific file something like "cvs update filename"
cvs update filename
I tried "git checkout -- filename
" which simply not doing anything.
I followed these step:s
#Commit and push changes in foo.txt from Folder1 on Server1.
# On Servers
cd Folder2
git checkout -- foo.txt
Above command is just not doing any updates.
Upvotes: 1
Views: 1130
Reputation: 1324248
If you have push a commit from repo1 to repo2, then repo2 should directly see the updated file.
But just in case, You need to:
git fetch repo1
git checkout repo1/master -- path/to/file
Provided that repo2
has a remote named "repo1
".
If that remote is named "origin
" (default name), then
git fetch origin
git checkout origin/master -- path/to/file
In both cases, to see update on a specific file from a remote repo (like repo1
), you need to fetch that remote repo first into repo2
.
Upvotes: 1