git常用命令总结

创建库

git init
在github上创建远程库,直接复制里面的命令运行:git remote add origin git@github.com:YuQiao0303/本地库名.git (其中YuQiao0303 是github的用户名)

提交修改

git add *
git commit -m"commit message here"
git push origin 分支名

版本回退

git checkout -- filename 将撤销本地的修改
git rm test.txt 从版本库删除已从本地删除的文件

多人协作

查看分支:git branch
创建分支:git branch name
切换分支:git checkout name
创建+切换分支:git checkout -b name
合并某分支到当前分支:git merge name
保留分支历史的合并:git merge --no-ff -m "merge with no-ff" name>
删除分支:git branch -d name
看到分支合并图:git log --graph

如何退出vim

:wq Enter

原文地址:https://www.cnblogs.com/YuQiao0303/p/9767567.html