mirror of
https://github.com/jbranchaud/til
synced 2026-01-02 22:58:01 +00:00
Add Pulling In Changes During An Interactive Rebase as a git til
This commit is contained in:
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
||||
For a steady stream of TILs from a variety of rocketeers, checkout
|
||||
[til.hashrocket.com](https://til.hashrocket.com/).
|
||||
|
||||
_778 TILs and counting..._
|
||||
_779 TILs and counting..._
|
||||
|
||||
---
|
||||
|
||||
@@ -198,6 +198,7 @@ _778 TILs and counting..._
|
||||
- [List Most Git Commands](git/list-most-git-commands.md)
|
||||
- [List Untracked Files](git/list-untracked-files.md)
|
||||
- [Move The Latest Commit To A New Branch](git/move-the-latest-commit-to-a-new-branch.md)
|
||||
- [Pulling In Changes During An Interactive Rebase](git/pulling-in-changes-during-an-interactive-rebase.md)
|
||||
- [Rebase Commits With An Arbitrary Command](git/rebase-commits-with-an-arbitrary-command.md)
|
||||
- [Reference A Commit Via Commit Message Pattern Matching](git/reference-a-commit-via-commit-message-pattern-matching.md)
|
||||
- [Rename A Remote](git/rename-a-remote.md)
|
||||
|
||||
33
git/pulling-in-changes-during-an-interactive-rebase.md
Normal file
33
git/pulling-in-changes-during-an-interactive-rebase.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Pulling In Changes During An Interactive Rebase
|
||||
|
||||
My standard workflow when doing feature development is to checkout a feature
|
||||
branch and commit changes as I go. When the feature is finished, I clean up
|
||||
the commit history with an interactive rebase and then integrate those
|
||||
changes with `master`.
|
||||
|
||||
I initiate the interactive rebase like this (while on the feature branch):
|
||||
|
||||
```
|
||||
$ git rebase -i master
|
||||
```
|
||||
|
||||
This allows me to squash, fixup, and delete commits that I've made since
|
||||
checking out this branch from `master`.
|
||||
|
||||
It is important to note that an another thing will happen seemingly behind
|
||||
the scenes. Any commits on `master` since the feature branch was checked out
|
||||
will be applied to the feature branch before the effects of the interactive
|
||||
rebase are applied.
|
||||
|
||||
If you want to strictly do an interactive rebase of the commits on the
|
||||
feature branch ignoring what is on `master`, then reference the commit you
|
||||
checked out from -- put another way, reference the commit before the first
|
||||
commit on this branch.
|
||||
|
||||
```
|
||||
$ git rebase -i <sha-of-first-commit-on-this-branch>~
|
||||
```
|
||||
|
||||
The tilde (`~`) will go back one commit from the specified commit sha.
|
||||
|
||||
See `man git-rebase` for more details.
|
||||
Reference in New Issue
Block a user