Update README.md
NingZhao authored
964e550e
Name Last commit Last update
README.md Update README.md

git操作流程

1:从远端clone仓库

git clone 仓库链接

2.切换分支

git checkout dev/master

3.把开发的新功能提交到本地

git add .
git commit -m "注释"

4.提交到远程仓库前,从远程仓库更新当前最新代码.

git pull origin dev

5.将自己开发的新功能提交到远程分支

git push origin dev

6.测试完成后,将dev的功能合并到master 上面

git checkout master
git merge dev

7.将master合并的新功能,推送到远程仓库master上

git push origin master

8.从某个历史提交创建新的分支,并且切换到新分支:

#selected-branch 可为 hash值、分支名字 或者 tag名字 等
git checkout -b name-of-new-branch selected-branch

9.从某个tag创建新的分支,并且切换到新分支:

git checkout -b name-of-new-branch tag-name

10.新增一个 tag

git tag -a v1.0.1 -m "注释"
git push origin v1.0.1

11.删除 tag

#删除本地 tag
git tag -d v1.0.1
#删除远程 tag
git push origin --delete tag v1.0.1
#简写
git push origin :v1.0.1

12.创建分支:

#创建一个分支
git branch branchName
#创建并切换到新分支
git checkout -b branchName
#推送到远程
git push origin branchName
#查看本地分支
git branch
#查看远程分支
git branch -r

13.删除分支:

#删除本地分支
git branch -d branchName
#删除远程分支
git push origin --delete branchName
#简写
git push origin :branchName

14.撤销 git rebase 操作:

git rebase --abort