-
Notifications
You must be signed in to change notification settings - Fork 4
Tools and Tips
Shankar Ganesh edited this page Apr 20, 2021
·
4 revisions
git fetch upstream main
git checkout <your-branch>
git pull upstream main --rebase
git push origin <your-branch> -f
git branch -D main
git checkout -b main upstream/main
Follow the below steps to squash commits in a GitHub pull request:
git remote add upstream https://github.com/AlgoDataStructure/data-structure.git
git fetch upstream main
git checkout <your-branch-name>
git rebase -i upstream/main
==
- Choose squash for all of your commits, except the first one
- Edit the commit message to make sense, and describe all your changes >
==
git push origin <your-branch-name> -f
-
Do not use the main branch
-
Create a feature branch
git checkout -b feature/<FEATURE_NAME>
-
Fetch Latest upstream
git fetch upstream main
git pull upstream main --rebase
-
Rebase the 5 commits
git rebase -i head~5
-
cherry pick the add header component
git cherry-pick -n 8b5768943b653dba1bd9c4787c66196f37b0a79c
git reset head --hard
-
To merge the last two commits
git reset --soft "HEAD^"
git commit --amend
git push -f
-
delete all branch except
main
git branch | grep -v "master" | xargs git branch -D