Reputation: 46949
In the below commands I am trying to get update a local repository. But please let me know how to do it. In SVN we use svn update
to get the latest files from the trunk but how to do the same in git
Following are the commands
mkdir git_tut
git init --bare
git clone git_tut rep1
cd rep1
//create a file testfile.txt and add it
//This file contains the content as from rep
git add testfile.txt
git commit -a -m "comments"
git push origin master
//Now cd ../ and create a new reopo as rep2
git clone git_tut rep2
//Now in rep2
//In file testfile.txt add a new line and push to git_tut
How to update the new file in rep1 like svn up
Upvotes: 1
Views: 7440
Reputation: 2912
You need to do a git pull origin master
To resolve conflicts, I usually do the following:
`git diff` to see what the issues are and possibly manually fix them
`git revert the_filename` to revert changes if needed
`git add the_file` to add it to staging
`git commit -m "commit message"` to commit
`git push origin master` to send it off
You should check out the following references:
http://rogerdudler.github.com/git-guide/
Upvotes: 3
Reputation: 3476
You can use git fetch
If there any conflicts and you want to merge it , git pull is better option.
git pull = git fetch + git merge.
To see manual page , git pull --help
Upvotes: 1