Last active
March 10, 2023 15:31
-
-
Save sdesalas/78c829d758710d0bbe7095a887fd0c3d to your computer and use it in GitHub Desktop.
Git like a pro
This file contains hidden or 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
# Remove commit from current branch. Remote branch is MINE: I dont care about other people's commits (bad). | |
git rebase --onto $COMMIT_HASH^ $COMMIT_HASH && git push --force | |
# Remove commit from current branch. Remote branch is SHARED: Be careful with other people's commits. | |
git rebase --onto $COMMIT_HASH^ $COMMIT_HASH && git push --force-with-lease | |
# Alternate to rebasing | |
git reset --soft $COMMIT_HASH_BEFORE_CHANGES or HEAD~$NO_COMMITS_BEHIND | |
git stash | |
git checkout uat | |
git pull | |
git stash pop | |
git commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment