Git new branch, branch consolidation, version rollback Comments

A .git basic commands

1. git pull Warehouse Code
#拉取master代码
git clone git仓库地址
#拉取分支代码
git clone -b 分支名称 git仓库地址
2.git add code to your local repository
git add .
3.git submit code
git  commit -m "相关描述写这里"
4.git pulling Code
git pull
5.git code to the distal end of the push
#普通推送
git push
#强制命令
git push --force

Two .git local and remote branch rollback

1. git local version rollback
#git分支查看
git log (也可用 git log –oneline 查看)
#git回退命令
Git reset --hard commit_id
2. git remote version rollback
#远程提交回退
git push origin HEAD --force 

The following command can also implement remote version rollback

git reset --hard HEAD~1
git push --force

View Review:

git  status

Three branch code combined .git

Here mainly on how to master git branch code into their own branch of the code associated with other branches of the same

1. First switched to the main branch
git checkout master
2. git pull the leading pull down the main branch code
git pull
3. Switch to own branch
git checkout xxx(自己的分支)
4. The main branch code to merge their branch
git merge master
5.git push push up completed ok, now you own branch of the code and code as the main branch
git push origin 自己分支名

Guess you like

Origin www.cnblogs.com/charlypage/p/11105102.html