远程分支:remote_Branch
本地分支:loca_Branch
commit ID:6454878948116546
git提交本地代码到远程分支:
①git add .
②git commit -m "............."
③git push origin loca_Branch:remote_Branch
git设置本地分支关联远程分支(关联远程分支后直接git pull可直接拉取关联分支的代码):
①git branch --set-upstream-to=remote_Branch loca_Branch
git删除远程最近几个commit:
①本地分支先回退 git reset --hard 6454878948116546 (用--hard不会保存更改,不用--hard,需要git stash save ".....")
②再次push,需要添加-f参数 git push origin loca_Branch:remote_Branch -f
cherry-pick使用:在当前分支需要cherry-pick另一分支的commit,直接在当前分支用cherry-pick,后面跟另一分支的commit ID,例:
cherry-pick 6454878948116546
cherry-pick或git rebase 或则git stash pop过程中发生冲突,在解冲突后,git add 冲突文件,再用cherry-pick --continue
或git rebase --continue
修改当前commit信息 git commit --amend
新建git代码库: git init
git stash相关命令:
查看暂存去内容: git stash list
保存到暂存区: git stash save "....."
删除暂存区数据: git stash drop
取出暂存区数据: git stash pop