git简单使用

查看本地分支:git branch

查看远程分支:git branch -r 

创建本地新分支:git branch branch-name

切换分支:git checkout branch-name

创建并切换分支:git checkout -b branch-name

添加所有文件:git add .

添加指定文件:git add file

提交:git commit -m "message"

推送至远程:git push

删除本地分支:git branch -d branch-name

强制删除本地分支:git branch -D branch-name

删除远程分支:git branch -d -r origin/branch-name

       git push origin :branch-name

合并代码:git merge branch-name

 版本回退:git reset --hard HEAD^/HEAD^^/HEAD~100/versionid

暂存当前代码:git stash

查看当前暂存栈:git stash list

取出暂存的代码:git stash apply stash@{1}

清空暂存栈:git stash clear

原文地址:https://www.cnblogs.com/rayallenbj/p/9089029.html