common commands
edit commit
- for example to fix a typo
1
2
|
git rebase -i COMMIT_HASH
git reset HEAD~
|
If something went wrong with the rebase
this will discard the local state
1
2
|
git reset --HARD to get back the remote state
git reset ~HEAD if you have an unattached HEAD
|
- e.g. because I made a mistake during rebase
1
2
|
➜ git fetch origin
➜ git reset --hard origin/BRANCHNAME
|
Transfer changes from the master to another branch
1
2
|
git rebase --onto origin/development origin/development target_branch
git push -f
|
or use this when you’re in the working branch where the changes should be applied
1
|
git pull origin master --rebase
|
Change or split commit afterwards
- importaint: commit all files!
1
2
3
|
git rebase -i COMMIT_HASH
git reset HEAD~
git rebase --continue
|
https://codewithhugo.com/split-an-existing-git-commit/
Tagging
1
2
|
git tag 4.1.0 1234easd2132131 (commit id)
git push origin 4.1.0
|
- or if you need to delete them
1
2
|
git tag -d 0.1.5
git push origin -d 0.1.5
|
commitlint WORK IN PROGRESS
This extension assumes you have configured commitlint in your project. Alternatively, you can configure your own rules using the commitlint.config.extend.rules
setting.
You will also need write your commit messages using VS Code. This extension supports both the built-in SCM input and the full editor.
installation
npm install -g @commitlint/cli @commitlint/config-conventional
add to a project
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js