Skip to content

Instantly share code, notes, and snippets.

@yiquncode
Created December 31, 2010 12:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yiquncode/760976 to your computer and use it in GitHub Desktop.
Save yiquncode/760976 to your computer and use it in GitHub Desktop.
Git代码同步
#线上
#获取代码
git clone ...
#获取更新
git pull
#如果在线上修改了代码,要推回
git push
#线上代码和git版本库冲突
#Your local changes to ... would be overwritten by merge
git fetch --all
git reset --hard origin/master
#开发环境
#如果要同步线上修改的代码
git pull
#此时应该会提示错误
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
#批量删除和提交
git commit -a -m 'this is memo'
@yiquncode
Copy link
Author

@feng88724
Copy link

以前一直以为git pull就可以同步,后来才知道,我错了。

@MajorQmz
Copy link

git Sync是干嘛用的啊?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment