Last active
February 13, 2024 15:47
-
-
Save peavers/56dab97a16ef8090638d5309e158ec89 to your computer and use it in GitHub Desktop.
Quick helper for git commands when dealing with fussy tech leads
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################## | |
# Squashing all commits to a single commit on your feature branch | |
git checkout feature_branch | |
git reset --soft develop #Whatever branch you're merging into | |
git add -A | |
git commit -m "feat: Add new meaningful feature" | |
git push | |
################## | |
# When you've got merge conflicts between your branch and develop | |
git checkout develop | |
git pull origin develop | |
git checkout feature_branch | |
git rebase develop | |
# Solve the commit issues, then execute: | |
git rebase --continue | |
# If not more issues, push to remote | |
git push --force-with-lease | |
################## | |
# How to rename a remote branch | |
git branch new_branch_name origin/old_branch_name | |
git push origin --set-upstream new_branch_name | |
git push origin :old_branch_name # Deletes remote branch | |
################## | |
# How to change git author for one last commit | |
git commit --amend --author="Author Name <[email protected]>" --no-edit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
git clean -fd