在下面的命令中,我试图更新本地存储库。但请告诉我怎么做。在SVN中,我们使用svn update
从trunk获取最新文件但是如何在git中执行相同的操作
以下是命令
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
如何更新rep1中的新文件,例如svn up
答案 0 :(得分:3)
您需要执行git pull origin master
要解决冲突,我通常会执行以下操作:
`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
您应该查看以下参考资料:
答案 1 :(得分:1)
你可以使用git fetch
如果有任何冲突,你想合并它,git pull是更好的选择
git pull = git fetch + git merge。
要查看手册页,请执行git pull --help