git rebase interactive command

When rebasing commit history via git rebase -i we can use the following command. Example use-case

# In the todo list:

edit abc1234 Fix typo


Here are the most useful commands for removing or modifying commits:

When you run git rebase -i, Git opens a todo list where each commit is prefixed with a command. These are the commands you can use (aliases in parentheses):
Command
Alias
What it does
pick
p
Apply the commit as-is (default)
reword
r
Apply commit, but pause to edit only the commit message
edit
e
Apply commit, then pause so you can change files and run git commit --amend
squash
s
Combine this commit into the one above it & merge both commit messages
fixup
f
Combine this commit into the one above it & discard this commit's message
drop
d
Delete the commit entirely
break
b
Pause the rebase here (useful for manual testing before continuing)
exec
x
Run a shell command at this point in the history
label / reset / merge
l / t / m
Advanced commands for complex rebases (usually auto-generated by Git)

# After saving & exiting the editor, Git pauses here. You then:

git add <files>

git commit --amend

git rebase --continue

Then let's say we would like to make further modification 

-----

pick a1b2c3d Add user auth

fixup e4f5g6h Typo in auth

reword i7j8k9l Update README

edit m0n1o2p Refactor login

drop q3r4s5t Debug console.log

To move on the the next stage: Use git rebase --continue, --skip, or --abort as needed.



Comments

Popular posts from this blog

mongosh install properly

gemini cli getting file not defined error

vllm : Failed to infer device type