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:27] – [Initial state of the main 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 143: | Line 142: | ||
| ==== Creating the linked working tree ==== | ==== Creating the linked working tree ==== | ||
| - | Create a working tree off of an earlier tag ('' | + | Create a working tree off of an earlier tag ('' |
| < | < | ||
| - | $ git worktree add -b emergency ../temp 2.1.30 | + | $ git worktree add -b emergency ../temp 2.1.100 |
| - | Preparing | + | Preparing |
| - | HEAD is now at 90bdf0a Stahp updating bundler | + | HEAD is now at f2d0827 Merge pull request #1145 from rpjday/ |
| $ | $ | ||
| </ | </ | ||
| Line 161: | Line 160: | ||
| </ | </ | ||
| + | Note that nothing has changed in the current working tree: | ||
| + | |||
| + | < | ||
| + | $ git status | ||
| + | On branch master | ||
| + | Your branch is up to date with ' | ||
| + | |||
| + | Changes to be committed: | ||
| + | (use "git reset HEAD < | ||
| + | |||
| + | modified: | ||
| + | |||
| + | Changes not staged for commit: | ||
| + | (use "git add < | ||
| + | (use "git checkout -- < | ||
| + | |||
| + | modified: | ||
| + | |||
| + | $ | ||
| + | </ | ||
| ==== Move to new working tree ==== | ==== Move to new working tree ==== | ||
| < | < | ||
| $ pushd ../temp | $ pushd ../temp | ||
| + | </ | ||
| + | |||
| + | Check the status: | ||
| + | |||
| + | < | ||
| + | $ git status | ||
| + | On branch emergency | ||
| + | nothing to commit, working tree clean | ||
| + | $ | ||
| </ | </ | ||
| Line 177: | Line 205: | ||
| Verify current branch, and current position in history: | Verify current branch, and current position in history: | ||
| - | |||
| - | < | ||
| - | $ git status | ||
| - | On branch emergency | ||
| - | nothing to commit, working tree clean | ||
| - | $ | ||
| - | </ | ||
| < | < | ||
| $ git show | $ git show | ||
| - | commit | + | commit |
| + | Merge: 7a13f5a 5c0663e | ||
| Author: Ben Straub < | Author: Ben Straub < | ||
| - | Date: Tue Jan 16 10:31:13 2018 -0800 | + | Date: Mon Dec 10 10:06:11 2018 -0800 |
| - | | + | |
| + | |||
| + | maintaining: | ||
| - | diff --git a/ | ||
| - | index 9d0bcb2..cffacfd 100644 | ||
| - | --- a/ | ||
| - | +++ b/ | ||
| - | @@ -1,7 +1,6 @@ | ||
| - | | ||
| - | | ||
| - | | ||
| - | -- gem install bundler | ||
| - | - bundle install | ||
| - | | ||
| - | - script/ | ||
| $ | $ | ||
| </ | </ | ||
| - | Examine the '' | + | Examine the '' |
| < | < | ||
| Line 215: | 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 268: | 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 '' | ||