1. 取代码
git clone https://github.com/wanchain/go-wanchain.git
2. 切换分支
git checkout origin/jia_add_precomiled_contract
git checkout -b localbranch origin/remotebranch
3. 放弃本地修改,用本地库代码覆盖当前工作代码
git checkout filepath/filename
4. 放弃本地修改, 用远程库代码覆盖当前工作代码
git reset --hard origin/master
这个主要用于git pull时产生了merge冲突的情况, 一些文件没有手动merge的价值.直接用最新代码覆盖.
5. 手动merge
产生自动merge冲突后, 手动修改文件, 然后
git add file
git commit
6. git 设置代理
由于众所周知的原因, 有时候用git需要设置代理,
git命令不支持https_proxy, 使用如下命令
git config --global https.proxy http://192.168.1.69:8118
git config --global https.proxy https://192.168.1.69:8118
git config --global http.proxy 'socks5://127.0.0.1:8008'
git config --global https.proxy 'socks5://127.0.0.1:8008'
git config --global --unset http.proxy
git config --global --unset https.proxy
7. 删除文件
git rm xxx
git commit xxx
8. 打tag
git tag v1.0.1
git push origin v1.0.1