Git and Julia Tips for CliMA.Land
Rebase the commits before merging into main
- Switch to the feature branch and make sure you have a clean workspace
git checkout FeatureBranchgit statusto confirm zero uncommitted changes
- Backup current branch to avoid unexpected errors
git checkout -b FeatureBranch_Backup
- Sync the main branch
git checkout maingit pull
- Switch to the feature branch and merge main into it
git checkout FeatureBranchgit statusto confirm zero uncommitted changesgit merge main- Resolve conflicts and commit them if any
- Reabse the feature branch
git reset origin/mainto rewrite historygit diff(optional) would show all the changesgit add --allto add local changes on top of maingit commit -m "Single commit message"git push -fto force push because of the re-written history
- Create a Pull Request
- Through the web
- Remove local unnecessary branch (e.g., FeatureBranch_backup)
git branch -d FeatureBranch_Backupgit branch -D FeatureBranch_Backupto force remove