git create new branches, merge branches and withdraw push operations

git new branch

// 查看当前所在分支
git branch

// 创建本地分支并切换到新创建的分支
git checkout -b dev

// 再次查看所在分支
git branch

// 将新创建的分支信息推送到远程
git push origin HEAD -u


**git pull the code after the merged branch**
// 切换到自己的分支
git checkout <branch name>

// 拉取最新代码
git pull origin <最新代码分支名>

// 重新进行提交到自己的代码
git status
git add .
git commit -m "描述"
git push origin <branch name>


git branch merge

// 首先切换到你要合并的总分支
git checkout dev
 
// 然后通过merge拉去我们本地的分支
git merge test (test也就是我们master的子分支)
 
// 然后通过pull拉去远程分支
git pull origin Lucky(Lucky也是我们的分支)

git withdraw push

// 查看日志
git log

// 回滚到箭头的这个版本
git reset --soft d2fb2b0c80e6239ed400bf065d81f7f6c6ba8ca4

// 将本地的代码强制push到远程
git push origin dev --force

// 结束

Insert picture description here






related suggestion

// Liao Xuefeng's website
https://www.liaoxuefeng.com/wiki/896043488029600

// Getting started with git that monkeys can understand
https://backlog.com/git-tutorial/cn/intro/intro1_1.html

Guess you like

Origin blog.csdn.net/super__code/article/details/109467537