git常用操作

常用命令

# 代码下载
git clone xxxxxx
# 日志
git log
# 代码回退
git reset --hard 提交id

# 缓存管理
git stash list
git stash drop stash@{0}
git stash clear

# 查看状态 
git status

# 本地分支管理    
# 创建
git checkout -b 本地分支名 远程分支名
git checkout -b 本地分支名 -t 远程分支名
# 查看
git branch -a
git branch
# 删除
git branch -d 分支名
# 切换
git checkout 分支名
# 合并 分支A合并到B
git checkout B
git merge A

# 代码回退
# 回退到某个版本
git reset --hard <commit_id>
git push origin HEAD --force
# 回退本地commit
git reset HADE
git push origin developer --force
# 逆向提交本地commit
git revert HADE
git add
git commit
git push

代码提交流程

# 缓存本地修改
git stash 
# 拉取远程代码
git pull
# 提取本地缓存
git stash pop
# 解决冲突、提交代码

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理