Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| git_worktree [2019/02/24 13:33] – [Move to new working tree] rpjday | git_worktree [2019/03/06 08:24] (current) – [Additional issues to cover] rpjday | ||
|---|---|---|---|
| Line 97: | Line 97: | ||
| ==== Remove the worktree ==== | ==== Remove the worktree ==== | ||
| - | If you have no further use for the worktree, remove | + | If you have no further use for the worktree, remove |
| < | < | ||
| $ git worktree remove ../temp | $ git worktree remove ../temp | ||
| - | $ git worktree prune | ||
| $ git branch | $ git branch | ||
| emergency | emergency | ||
| Line 221: | Line 220: | ||
| </ | </ | ||
| - | Examine the '' | + | Examine the '' |
| < | < | ||
| Line 228: | Line 227: | ||
| $ | $ | ||
| </ | </ | ||
| - | ==== Commit some work in the new working tree ==== | + | ==== Make and commit a change |
| + | |||
| + | Make a change, and stage it: | ||
| < | < | ||
| - | $ git diff | + | $ git diff --cached |
| diff --git a/ | diff --git a/ | ||
| - | index d7810fd..0576243 | + | index fa40bad..9d69d12 |
| --- a/ | --- a/ | ||
| +++ b/ | +++ b/ | ||
| - | @@ -1,4 +1,4 @@ | + | @@ -1,3 +1,5 @@ |
| - | -= Pro Git, Second Edition | + | +Change to README.asc on emergency branch in worktree |
| - | += Pro Git, Second Edition | + | + |
| + | = Pro Git, Second Edition | ||
| | | ||
| - | |||
| $ | $ | ||
| </ | </ | ||
| + | |||
| + | Commit: | ||
| < | < | ||
| - | $ git commit | + | $ git commit -m "Change README.asc in worktree" |
| - | [emergency | + | [emergency |
| - | 1 file changed, | + | 1 file changed, |
| $ | $ | ||
| </ | </ | ||
| + | |||
| + | Verify: | ||
| < | < | ||
| $ git show | $ git show | ||
| - | commit | + | commit |
| Author: Robert P. J. Day < | Author: Robert P. J. Day < | ||
| - | Date: Tue Feb 6 09:48:48 2018 -0500 | + | Date: Sun Feb 24 08:36:12 2019 -0500 |
| - | | + | |
| diff --git a/ | diff --git a/ | ||
| - | index d7810fd..0576243 | + | index fa40bad..9d69d12 |
| --- a/ | --- a/ | ||
| +++ b/ | +++ b/ | ||
| - | @@ -1,4 +1,4 @@ | + | @@ -1,3 +1,5 @@ |
| - | -= Pro Git, Second Edition | + | +Change to README.asc on emergency branch in worktree |
| - | += Pro Git, Second Edition | + | + |
| + | = Pro Git, Second Edition | ||
| | | ||
| - | |||
| $ | $ | ||
| </ | </ | ||
| Line 281: | Line 286: | ||
| </ | </ | ||
| - | Still on '' | + | Everything here is just where we left it: |
| < | < | ||
| $ git status | $ git status | ||
| On branch master | On branch master | ||
| - | Your branch is up-to-date with 'origin/ | + | Your branch is up to date with 'rpjday/ |
| - | nothing | + | Changes |
| - | $ | + | (use "git reset HEAD <file>..." to unstage) |
| - | </code> | + | |
| - | Linked | + | modified: |
| + | |||
| + | Changes not staged for commit: | ||
| + | (use "git add < | ||
| + | (use "git checkout -- < | ||
| + | |||
| + | modified: LICENSE.asc | ||
| - | < | ||
| - | $ git branch | ||
| - | emergency | ||
| - | * master | ||
| $ | $ | ||
| </ | </ | ||
| + | |||
| + | Linked working tree and '' | ||
| < | < | ||
| $ git worktree list | $ git worktree list | ||
| - | / | + | / |
| - | / | + | / |
| $ | $ | ||
| </ | </ | ||
| < | < | ||
| - | $ git show emergency | + | $ git branch |
| - | commit 6bf829d7e63b1184c73546aa94625849054b1ebc (emergency) | + | emergency |
| - | Author: Robert P. J. Day < | + | * master |
| - | Date: Tue Feb 6 09:48:48 2018 -0500 | + | |
| - | + | ||
| - | silly change | + | |
| - | + | ||
| - | diff --git a/ | + | |
| - | index d7810fd..0576243 100644 | + | |
| - | --- a/ | + | |
| - | +++ b/ | + | |
| - | @@ -1,4 +1,4 @@ | + | |
| - | -= Pro Git, Second Edition | + | |
| - | += Pro Git, Second Edition (rday) | + | |
| - | + | ||
| - | | + | |
| - | + | ||
| $ | $ | ||
| </ | </ | ||
| + | |||
| + | What you choose to do with the work committed to the '' | ||
| ==== Remove working tree ==== | ==== Remove working tree ==== | ||
| - | Remove | + | Once you're done with the worktree, remove it and " |
| < | < | ||
| - | $ rm -rf ../temp | + | $ git worktree remove |
| - | </ | + | [rpjday@localhost progit2]$ git worktree list |
| - | + | / | |
| - | Still seems to be there: | + | |
| - | + | ||
| - | < | + | |
| - | $ git worktree list | + | |
| - | / | + | |
| - | / | + | |
| $ | $ | ||
| </ | </ | ||
| - | We need to " | + | Note that the '' |
| < | < | ||
| - | $ git worktree prune | + | $ git branch |
| - | [rpjday@android-a172fe96dd584b41 progit2]$ git worktree list | + | emergency |
| - | / | + | * master |
| - | $ | + | |
| - | </ | + | |
| - | + | ||
| - | But our work that was committed from that working tree is still there in the object store: | + | |
| - | + | ||
| - | < | + | |
| - | $ git show emergency | + | |
| - | commit 6bf829d7e63b1184c73546aa94625849054b1ebc (emergency) | + | |
| - | Author: Robert P. J. Day < | + | |
| - | Date: Tue Feb 6 09:48:48 2018 -0500 | + | |
| - | + | ||
| - | silly change | + | |
| - | + | ||
| - | diff --git a/ | + | |
| - | index d7810fd..0576243 100644 | + | |
| - | --- a/ | + | |
| - | +++ b/ | + | |
| - | @@ -1,4 +1,4 @@ | + | |
| - | -= Pro Git, Second Edition | + | |
| - | += Pro Git, Second Edition (rday) | + | |
| - | + | ||
| - | | + | |
| - | + | ||
| $ | $ | ||
| </ | </ | ||
| - | ===== Additional issues ===== | + | ===== Additional issues |
| * locking and unlocking working trees | * locking and unlocking working trees | ||
| * moving working trees | * moving working trees | ||
| - | | + | * git config |
| - | | + | |
| * config var '' | * config var '' | ||
| * config var '' | * config var '' | ||