提交流程
1、添加文件到暂存区
git add 文件名1 文件名2 ...
//添加一个或多个文件
git add .
//添加当前目录下的所有文件
2、将暂存区内容添加到本地仓库中
git commit -m '备注'
3、将本地提交到服务器
git push
放弃修改
未add时
//丢弃所有
git checkout .
//丢弃某个文件 <file>为文件路径
git checkout <file>
撤销commit
取消最近一次提交,并保留改动
git reset HEAD~1
查看分支
git branch -a
切换分支
git checkout <branch_name>
SourceTree操作Git 出现报错:
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks fetch origin
解决办法:进入根目录执行
git config http.sslVerify "false"
切换分支冲突解决方法:
1.先暂存当前分支修改:git stash
2.切换一个新的分支:git checkout sean/temp(新分支名称)
3.在新分支下取出暂存的分支:git stash pop
4.取出暂存后,重新提交即可