-
Notifications
You must be signed in to change notification settings - Fork 89
Add git tips #669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add git tips #669
Conversation
EbonJaeger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably add "worktree" and "worktrees" to the allowed words list, too, so the spellchecker stops complaining.
| ## Use worktrees to make switching between branches easier | ||
|
|
||
| It's possible to create a worktree to make working with things like stack updates easier. | ||
| If you need to switch focus, you can switch to a different folder with a different worktree (like main). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If you need to switch focus, you can switch to a different folder with a different worktree (like main). | |
| If you need to switch focus, you can switch to a different folder with a different worktree (like `main`). |
|
|
||
| ## Splitting a commit during `rebase -i` | ||
|
|
||
| There may be times when you're in the middle of an interactive rebase where you want to split a commit. To do this, start by running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| There may be times when you're in the middle of an interactive rebase where you want to split a commit. To do this, start by running | |
| There may be times when you're in the middle of an interactive rebase and you want to split a commit. To do this, start by running: |
| git rebase -i origin/HEAD --autostash | ||
| ``` | ||
|
|
||
| Then, find the needed commit and change pick to e (short for edit), save and exit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Then, find the needed commit and change pick to e (short for edit), save and exit. | |
| Then, find the needed commit and change "pick" to "e" (short for edit), save and exit. |
I'm not entirely sure if those should be quoted, or code text (like pick and e).
| ``` | ||
|
|
||
| Then, find the needed commit and change pick to e (short for edit), save and exit. | ||
| Then run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Then run | |
| Then run: |
| git reset HEAD~ | ||
| ``` | ||
|
|
||
| If you run `git status` you can see the changes are unstaged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If you run `git status` you can see the changes are unstaged. | |
| If you run `git status`, you will see the changes are unstaged. |
| ``` | ||
|
|
||
| If you run `git status` you can see the changes are unstaged. | ||
| Then `gotopkg your-package` and run `git add` and `git commit` as normal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Then `gotopkg your-package` and run `git add` and `git commit` as normal. | |
| Then, change to the package directory you want with `gotopkg your-package`, and run `git add` and `git commit` as normal. |
| If you run `git status` you can see the changes are unstaged. | ||
| Then `gotopkg your-package` and run `git add` and `git commit` as normal. | ||
| Do the same for the second split. | ||
| Then run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Then run | |
| When you are finished, complete the rebase and push the branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think both this line and the previous one should also either be on the same line, or have a blank line added between them.
Description
Add using worktreses and how to split
a commit during interactive rebase
Fixes #570
Fixes #571