Skip to content

Commit

Permalink
feat(git): 📝 Give a litle fixing up history example
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisguest75 committed Apr 1, 2024
1 parent e48e6e4 commit 5dae048
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 3 deletions.
60 changes: 60 additions & 0 deletions 36_git/sections/FIXING_HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# FIXING HISTORY

Demonstrate some simple commands useful to fixing history in a branch.

TODO:

* Work out how to use Fixup

## Reason

If you have long term PRs that you occasionally come back to fix up and merge. You may experience problems if you've added `conventional-commits` or `husky` to the repo. Meaning a rebase with force push it might fail.

## Rewrite

NOTE: To amend the title you can use `reword`.

```sh
# look at the history
git log --oneline --graph -n 10

# find the merge base
git merge-base head~1 master

# use the commitid in an interactive rebase
git rebase -i 32cbeee2bc4b9fc502e1ec9c217326a83ee536e3..head

# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup [-C | -c] <commit> = like "squash" but keep only the previous
# commit's log message, unless -C is used, in which case
# keep only this commit's message; -c is same as -C but
# opens the editor
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# create a merge commit using the original merge commit's
# message (or the oneline, if no original merge commit was
# specified); use -c <commit> to reword the commit message
# u, update-ref <ref> = track a placeholder for the <ref> to be updated
# to this position in the new commits. The <ref> is
# updated at the end of the rebase
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
```

## Resources

* GIT tip : Keep your branch clean with fixup and autosquash [here](https://fle.github.io/git-tip-keep-your-branch-clean-with-fixup-and-autosquash.html)
* GIT - The power of fixup & autosquash [here](https://congtuanle.medium.com/git-the-power-of-fixup-autosquash-f1c91f7d962b)
* Smoother rebases with auto-squashing Git commits [here](https://andrewlock.net/smoother-rebases-with-auto-squashing-git-commits/)
5 changes: 2 additions & 3 deletions 47_ffmpeg/RECORDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@ ffmpeg -f avfoundation -framerate 30 -video_size 640x480 -i "0:0" -vcodec libx26

## Resources

https://trac.ffmpeg.org/wiki/Capture/PulseAudio

https://unix.stackexchange.com/questions/1670/how-can-i-use-ffmpeg-to-split-mpeg-video-into-10-minute-chunks
* https://trac.ffmpeg.org/wiki/Capture/PulseAudio
* https://unix.stackexchange.com/questions/1670/how-can-i-use-ffmpeg-to-split-mpeg-video-into-10-minute-chunks

0 comments on commit 5dae048

Please sign in to comment.