This document contains information related to preparing changes for a pull request.
We highly recommend following the Convential Commits format when committing changes.
Our prefixes are derived from the official specification as well as the those found in commitlint, based on Angular's commit conventions.
When in doubt, use feat
, fix
, or chore
!
Moreover, please sign your commits using git commit -s
.
You can amend an existing commit with git commit -s --amend
, if needed.
This is an opinionated guide for rebasing your local branch with the latest changes from main
.
It does not necessarily reflect present-day best practices and is designed for those who would like to perform the
aforementioned action(s) without spending too much time thinking about them.
- Ensure you have VS Code installed.
- Ensure your local tree is clean and everything is pushed up to the corresponding remote branch.
- This will make it easier if we want to see the diff on GitHub later.
- Open VS Code and create a new terminal within the application.
- We will execute this guide's commands in this terminal in order to get
CMD + LEFT CLICK
functionality for files with conflicts.
- We will execute this guide's commands in this terminal in order to get
- Run
git pull --rebase origin main
to start the process.- If there is at least “conflict area” for that one commit that git cannot figure out, it’ll drop you into interactive rebase mode.
- It will keep you in interactive rebase until you have finishing “continuing” through all the commits.
- Run
git status
to see what is wrong and where there are conflicts. - Open all files with conflicts by clicking
CMD + LEFT CLICK
on each one. - In each “conflict area” in a given file, you’ll have options (font size is small) at the top to help resolve the conflict(s).
- Affected files are marked with a red exclamation point in the VS Code file picker.
- In those options, “Current” refers to
HEAD
, which ismain
in our case. - In those same options, “Incoming” refers to changes on our branch.
- You can the options or manually intervene to make changes. Sometimes, you may want to accept everything on HEAD or your local branch and just triage manually. Sometimes, you’ll want to not accept anything and manually triage the whole thing. Sometimes you’ll want to do both. It depends!
- Finally, it can be useful to have your branch diff open on GitHub to see what you changed before the rebase:
https://github.com/systeminit/si/compare/main...<your-branch>
.
- Once all conflict areas for “unmerged paths” (files with conflicts) have been resolved, run
git add
with either the entire current working directory and below (.
) or specific files/directories (e.g.lib/dal/src lib/sdf-server/src/
) as the next argument(s). - Now run
git status
again. The output should indicate that conflicts have been resolved and that we can continue rebasing. - If everything looks good in the output, run
git rebase --continue
. You will have an opportunity to amend your commit message here, if desired.- You will not have to necessarily the “human fix this conflict area” process for every commit.
- It will only happen for commits with conflict areas.
- Once the interactive rebase ends (or never even started if there were no conflicts), you should be good to push! Now, run
git push
.- You will likely have to add the
-f/--force
flag since we are overwriting history (technically?) on the remote. - Be careful when using the force flag! Try to push without using the force flag first if you are unsure.
- You will likely have to add the
- You are done! Congratulations!
This is an opinionated guide for squashing the commits on your local branch and pushing them to your corresponding remote branch. It does not necessarily reflect present-day best practices and is designed for those who would like to perform the aforementioned action(s) without spending too much time thinking about them.
- Ensure your local tree is clean and everything is pushed up to the corresponding remote branch.
- This will make it easier if we want to see the diff on GitHub later.
- Count the numer of commits that you'd like to squash.
- Navigating to your branch diff on GitHub can be helpful here:
https://github.com/systeminit/si/compare/main...<your-branch-name>
- Navigating to your branch diff on GitHub can be helpful here:
- Run
git reset --soft HEAD~N
whereN
is the name of commits (example:git reset --soft HEAD~2
where you'd like to squash two commits into one). - Run
git status
to see all staged changes from the commits that were soft reset. - Now, commit your changes (e.g.
git commit -s
). - Finally, run
git push
.- You will likely have to add the
-f/--force
flag since we are overwriting history (technically?) on the remote. - Be careful when using the force flag! Try to push without using the force flag first if you are unsure.
- You will likely have to add the
- You are done! Congratulations!