首页 > 其他 > 详细

git worktree 实际使用

时间:2020-04-30 15:14:17      阅读:58      评论:0      收藏:0      [点我收藏+]

Create

1.mkdir Connect_Backend_Database

2. cd Connect_Backend_Database

3. git clone url main

4. cd main

5. git worktree add -b v5 ../v5 origin/v5

6. git worktree add -b v6 ../v6 origin/v6

7.  git worktree list

 

Clean

1.cd Connect_Backend_Database/main

2. rm -rf ../v5

3. rm -rf ../v6

4. git worktree prune

5. git worktree list

 

https://git-scm.com/docs/git-worktree

You are in the middle of a refactoring session and your boss comes in and demands that you fix something immediately. You might typically use git-stash[1] to store your changes away temporarily, however, your working tree is in such a state of disarray (with new, moved, and removed files, and other bits and pieces strewn around) that you don’t want to risk disturbing any of it. Instead, you create a temporary linked working tree to make the emergency fix, remove it when done, and then resume your earlier refactoring session.

$ git worktree add -b emergency-fix ../temp master
$ pushd ../temp
# ... hack hack hack ...
$ git commit -a -m ‘emergency fix for boss‘
$ popd
$ git worktree remove ../temp

 

git worktree 实际使用

原文:https://www.cnblogs.com/chucklu/p/12808676.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!