4 ms·
I barely skimmed what's below so maybe someone else has covered this, maybe not. If I need to hack on a task and I know I'm the only person that's going to wor
by ghotli 5y ago
I barely skimmed what's below so maybe someone else has covered this, maybe not.
If I need to hack on a task and I know I'm the only person that's going to work on the branch I amend changes to my commit basically constantly. The only reason I might not is if I want multiple commits on the branch to make review simpler for others.
```
git fetch && git checkout main
git branch feature/JIRA-###/words-describing-it
git checkout feature/JIRA-###/words-describing-it
<do some work>
git add .
git commit -m "JIRA-###: words / description"
git push -u origin feature/JIRA-###/words-
describing-it
<review CI build, make more changes>
git add .
git amend
git push -f
```
`git amend` is an alias in my ~/.gitconfig
```
#cat ~/.gitconfig
<snip>
[alias]
amend = commit --amend --no-edit
```
So most of my commits I just amend the first commit I made, force push, review CI build results, rinse repeat until it's ready for review.
Simplest thing that works when it's just my own work on a branch. I'll also do a rebase pre PR review if need be.
```
git fetch && git rebase -i origin/main
git status
<do what it says if anything>
git add <fixed files>
git rebase --continue
git push -f
```