Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```
- 一键拉取本地上不存在的远程分支
- git checkout br
- git pull
- ```
- ```
- 查看本地以及远程分支
- git branch -a
- ```
- ```
- 删除远程分支
- git push origin :br (origin 后面有空格)
- ```
- ```
- 查看标签
- git tag
- 打标签
- git tag -a v1.1 -m 'my version 1.1'
- 推送本地tag到远端
- git push origin v1.1
- 删除本地tag
- git tag -d v1.1
- 删除远端tag
- git push origin :refs/tags/v1.1
- ```
- ```
- 删除远程仓库中的提交版本
- git reset --hard 版本号
- git push origin master -f
- ```
- ```
- 如何修改之前的 commit 信息
- 其实并不复杂,我们只需要这样做:
- 1、将当前分支无关的工作状态进行暂存
- git stash
- 2、将 HEAD 移动到需要修改的 commit 上
- git rebase 9633cf0919^ --interactive
- 3、找到需要修改的 commit ,将首行的 pick 改成 edit
- 4、开始着手解决你的 bug
- 5、git add 将改动文件添加到暂存
- 6、git commit –amend 追加改动到提交
- 7、git rebase –continue 移动 HEAD 回最新的 commit
- 8、恢复之前的工作状态
- git stash pop
- ```
- ```
- 本地拉取远端git pull出错
- > Pull is not possible because you have unmerged files.
- Please, fix them up in the work tree, and then use 'git add/rm <file>'
- as appropriate to mark resolution, or use 'git commit -a'
- 如果想放弃本地的文件修改,可以使用git reset --hard FETCH_HEAD,FETCH_HEAD表示上一次成功git pull之后形成的commit点。然后git pull就OK了。
- ```
- ```
- .gitconfig配置
- [alias]
- co = checkout
- ci = commit
- ci0 = commit -a --allow-empty-message -m ''
- st = status
- br = branch
- pl = log --pretty=oneline
- rpl = reflog --pretty=oneline
- back = reset --hard
- [user]
- name = weber-Huang
- email = funccn@gmail.com
- ```
Add Comment
Please, Sign In to add comment