git 常用命令

查看分支
git branch -av
导出分支
git remote add origin ssh://git@ip:port/branch.git
git checkout -b localbranch origin/remotebranch
稀疏导出
git init <project>
cd <project>
git config core.sparsecheckout true
echo "path1/" >> .git/info/sparse-checkout
echo "path2/" >> .git/info/sparse-checkout
git pull origin remotebranch
恢复误删除文件
git status
git reset HEAD
git checkout .
non-fast-forward
git fetch origin master
git merge origin FETCH_HEAD
本地rebase导致non-fast-forward
git reflog  查看HEAD的移动历史
git reset --hard xxxx
提交
git push origin localbranchname

 

参考及引用

图片 from 墨玉

 

Comments are closed.