当前位置:网站首页>1.5 merge\rebase\revert\stash\branch
1.5 merge\rebase\revert\stash\branch
2022-07-28 08:24:00 【LetsStudy】
1、git merge <branch>合并分支
git checkout master //当前分支是master
git branch test //以master为基,新建test分支
git checkout test //检出test分支,修改内容
git checkout master //检出master分支
git merge test//把test分支合并到master分支2、git pull / git fetch
git pull origin master:test //拉取远程master分支,合并到本地test分支
等同于
git fetch origin master
git merge FETCH_HEAD3、git rebase
git rebase master //变基,以最新的master分支为基,拉取代码并合并到本地分支
等同于
git pull -r origin master
或
git pull -rebase origin master
4、git revert
//常规撤回,会产生一条新的提交记录
git revert <commitId>
/*
* merge commit 撤回
* merge commit会有两个parent commitId
* 代表着从哪两个commitId的合并
* 所以-m的值为1或2,代表着保留哪个提交
**/
git revert <commitId> -m 1
//revert后再在当前分支进行merge,之前被revert的文件不会被merge进来
//master分支合并release分支,后revert,release分支修改后,master无法在合并release分支问题
git branch test //在master上新拉一个test分支
git checkout test //检出test分支
git show //查看commit记录
git revert <commitId> // 在test分支上执行revert操作
git merge release //在test分支上合并release
git checkout master //检出master
git merge test //在master分支上合并test
git branch -d test //删除test分支5、git branch
git branch test //新拉分支
git branch //查看本地分支
git branch -r //查看远程分支
git push origin -d <branchName> //删除远程分支
git branch -d <branchName> //删除本地分支6、git stash
存档暂存区和工作区
git stash save test1 //新增加的代码且commit的,会被临时保存起来
git stash list //查看保存的历史列表
git stash pop 0 //恢复临时保存的内容,不指定恢复记录的话,则默认恢复最新的保存记录
git stash apply 0 //可以在切换分支时使用,将保存的记录恢复到其他分支中
git stash drop 0 //清除指定的记录
git stash clear //清除所有存储记录
git stash show //查看存储的记录与当前的文件差异
git stash show 0 //查看指定的存储记录与当前文件的差异
git stash show 0 -p //查看详细的差异
git stash branch <branchName> 0 //根据某个存储记录,拉一个新分支,用于手动解决冲突边栏推荐
- 看完这12个面试问题,新媒体运营岗位就是你的了
- Overview of head pose estimation
- CSV file storage
- Review the past and know the new MySQL isolation level
- There is a bug in installing CONDA environment
- How to execute the SQL assembled in ODPs SQL function and get the return value?
- 修改虚拟机IP地址
- c语言数组指针和指针数组辨析,浅析内存泄漏
- Image batch processing | necessary skills
- Sword finger offer
猜你喜欢
Mobaxtermsession synchronization

Quickly build a gateway service, dynamic routing and authentication process, and watch the second meeting (including the flow chart)

Machine learning (11) -- time series analysis

Do you know the five minute rule and the ten byte rule?

Recommend an artifact to get rid of the entanglement of variable names and a method to modify file names in batches

Basic syntax of jquey

1w5 words to introduce those technical solutions of distributed system in detail

Learn to draw with nature communications -- complex violin drawing

View the dimensions of the list

Div tags and span Tags
随机推荐
Top all major platforms, 22 versions of interview core knowledge analysis notes, strong on the list
CSV file storage
1w5 words to introduce those technical solutions of distributed system in detail
Prometheus TSDB analysis
看得清比走得快更重要,因为走得对才能走得远
修改虚拟机IP地址
Machine learning: self paced and fine tuning
从开发转测试:我从零开始,一干就是6年的自动化测试历程
Competition: diabetes genetic risk detection challenge (iFLYTEK)
49 opencv deep analysis profile
NPM and yarn use (official website, installation, command line, uploading your own package, detailed explanation of package version number, updating and uninstalling package, viewing all versions, equ
SQL server time field sorting
10. Learn MySQL like clause
PHP Basics - PHP uses PDO
Mongodb (compare relational database, cloud database, common command line, tutorial)
【leetcode周赛总结】LeetCode第 83场双周赛(7.23)
12 common design ideas of design for failure
网络层的IP协议
MDM data quality application description
一年涨薪三次背后的秘密