Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions docs/packaging/git-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,37 @@
git branch -D my-branch
git push -d origin my-branch
```
# Tips and Tricks

## Use worktrees to make switching between branches easier

Check warning on line 60 in docs/packaging/git-basics.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (worktrees)

It's possible to create a worktree to make working with things like stack updates easier.

Check warning on line 62 in docs/packaging/git-basics.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (worktree)
If you need to switch focus, you can switch to a different folder with a different worktree (like main).

Check warning on line 63 in docs/packaging/git-basics.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (worktree)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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`).

When you're ready to return to previous work, like the stack update, change to its folder.

The [official docs from git](https://git-scm.com/docs/git-worktree) have details on how to do this.

## 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:


```bash
git rebase -i origin/HEAD --autostash

Check warning on line 73 in docs/packaging/git-basics.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (autostash)
```

Then, find the needed commit and change pick to e (short for edit), save and exit.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 run
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Then run
Then run:


```bash
git reset HEAD~
```

If you run `git status` you can see the changes are unstaged.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you run `git status` you can see the changes are unstaged.
If you run `git status`, you will see the changes are unstaged.

Then `gotopkg your-package` and run `git add` and `git commit` as normal.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Do the same for the second split.
Then run
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Then run
When you are finished, complete the rebase and push the branch.

Copy link
Member

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.


```bash
git rebase --continue
git push --force-with-lease
```
Loading