Skip to content

Conversation

@TraceyC77
Copy link
Contributor

Description

Add using worktreses and how to split
a commit during interactive rebase

Fixes #570
Fixes #571

Add using worktreses and how to split
  a commit during interactive rebase

Fixes #570
Fixes #571
@TraceyC77 TraceyC77 added the hacktoberfest-accepted Allows a PR to be counted toward hacktoberfest, even if it's merged after Oct. 31st. label Oct 24, 2025
Copy link
Member

@EbonJaeger EbonJaeger left a 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).
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`).


## 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:

git rebase -i origin/HEAD --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, find the needed commit and change pick to e (short for edit), save and exit.
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:

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.

```

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

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

@github-project-automation github-project-automation bot moved this from Backlog to Under Review in Web and Documentation Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted Allows a PR to be counted toward hacktoberfest, even if it's merged after Oct. 31st.

Projects

Status: Under Review

Development

Successfully merging this pull request may close these issues.

Additions to git tips & tricks - splitting a commit during rebase -i Additions to git tips & tricks - worktrees

3 participants