User Tools

Site Tools


git_worktree

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
git_worktree [2019/02/24 13:39]
rpjday [Return to main working tree]
git_worktree [2019/03/06 08:24] (current)
rpjday [Additional issues to cover]
Line 97: Line 97:
 ==== Remove the worktree ==== ==== Remove the worktree ====
  
-If you have no further use for the worktree, remove ​and prune, which has no effect on the branch that was created:+If you have no further use for the worktree, remove ​it, which has no effect on the branch that was created:
  
 <​code>​ <​code>​
 $ git worktree remove ../temp $ git worktree remove ../temp
-$ git worktree prune 
 $ git branch $ git branch
   emergency   emergency
Line 230: Line 229:
 ==== Make and commit a change in the worktree ==== ==== Make and commit a change in the worktree ====
  
-Stage a change:+Make a change, and stage it:
  
 <​code>​ <​code>​
Line 308: Line 307:
 </​code>​ </​code>​
  
-Linked working tree is still there and available:+Linked working tree and ''​emergency''​ branch are still there:
  
 <​code>​ <​code>​
-$ git branch +$ git worktree list 
-  ​emergency +/​home/​rpjday/​ebooks/​progit/​progit2 ​ 5df317d [master
-master+/​home/​rpjday/​ebooks/​progit/​temp ​    ​8b31c7b [emergency]
 $ $
 </​code>​ </​code>​
  
 <​code>​ <​code>​
-$ git worktree list +$ git branch 
-/​home/​rpjday/​ebooks/​progit/​progit2 ​ dd124f7 [master] +  emergency 
-/​home/​rpjday/​ebooks/​progit/​temp ​    ​6bf829d [emergency]+* master
 $ $
 </​code>​ </​code>​
  
-<​code>​ +What you choose ​to do with the work committed to the ''​emergency''​ branch is up to you.
-$ git show emergency +
-commit 6bf829d7e63b1184c73546aa94625849054b1ebc (emergency) +
-Author: Robert P. J. Day <​rpjday@crashcourse.ca>​ +
-Date:   Tue Feb 6 09:48:48 2018 -0500 +
- +
-    silly change +
- +
-diff --git a/​README.asc b/​README.asc +
-index d7810fd..0576243 100644 +
---- a/​README.asc +
-+++ b/​README.asc +
-@@ -1,4 +1,4 @@ +
--= Pro Git, Second Edition +
-+= Pro Git, Second Edition (rday) +
-  +
- ​Welcome ​to the second edition of the Pro Git book. +
-  +
-+
-</​code>​+
  
 ==== Remove working tree ==== ==== Remove working tree ====
  
-Remove ​the directory itself:+Once you're done with the worktree, remove it and "​prune"​ it:
  
 <​code>​ <​code>​
-rm -rf ../temp +git worktree remove ​../temp 
-</​code>​ +[rpjday@localhost progit2]$ git worktree list 
- +/​home/​rpjday/​ebooks/​progit/​progit2  ​5df317d ​[master]
-Still seems to be there: +
- +
-<​code>​ +
-$ git worktree list +
-/​home/​rpjday/​ebooks/​progit/​progit2  ​dd124f7 ​[master+
-/​home/​rpjday/​ebooks/​progit/​temp ​    ​6bf829d [emergency]+
 $ $
 </​code>​ </​code>​
  
-We need to "​prune"​ deleted working trees:+Note that the ''​emergency''​ branch still exists.
  
 <​code>​ <​code>​
-$ git worktree prune +$ git branch 
-[rpjday@android-a172fe96dd584b41 progit2]$ git worktree list +  emergency 
-/​home/​rpjday/​ebooks/​progit/​progit2 ​ dd124f7 [master] +* master
-+
-</​code>​ +
- +
-But our work that was committed from that working tree is still there in the object store: +
- +
-<​code>​ +
-$ git show emergency +
-commit 6bf829d7e63b1184c73546aa94625849054b1ebc (emergency) +
-Author: Robert P. J. Day <​rpjday@crashcourse.ca>​ +
-Date:   Tue Feb 6 09:48:48 2018 -0500 +
- +
-    silly change +
- +
-diff --git a/​README.asc b/​README.asc +
-index d7810fd..0576243 100644 +
---- a/​README.asc +
-+++ b/​README.asc +
-@@ -1,4 +1,4 @@ +
--= Pro Git, Second Edition +
-+= Pro Git, Second Edition (rday) +
-  +
- ​Welcome to the second edition of the Pro Git book. +
- +
 $ $
 </​code>​ </​code>​
  
-===== Additional issues =====+===== Additional issues ​to cover =====
  
   * locking and unlocking working trees   * locking and unlocking working trees
   * moving working trees   * moving working trees
-  ​* gc.worktreePruneExpire +  * git config ​%%--%%worktree (man git-config)
-  ​* git config --worktree (man git-config)+
   * config var ''​extensions.worktreeConfig''​   * config var ''​extensions.worktreeConfig''​
   * config var ''​gc.worktreePruneExpire''​   * config var ''​gc.worktreePruneExpire''​
git_worktree.1551015544.txt.gz · Last modified: 2019/02/24 13:39 by rpjday