Skip to content

How To Git

Mark Woon edited this page Jun 9, 2022 · 6 revisions

Commit Messages

PharmCAT uses the Conventional Commit convention.

feat, perf, and fix commit types will get listed in the change log, so please include a scope when using those types.

Scopes:

  • data
  • datamanager
  • preprocessor
  • namedallelematcher
  • reporter
  • docker
  • website

Git Conventions

If you are working against the repo directly instead of using GitHub's pull requests, please use git rebase instead of git merge.

Why not merge? A comparison and some horror stories.

Show Me the Money

This is a very brief outline of what you should do before pushing your commits to the repository. If you just want to update to the latest from the repository, you can skip the last step.

  1. git fetch
  2. git status
  3. maybe git stash
  4. git pull or git pull --rebase
  5. git push

Breaking it down:

# git fetch

This gets the latest changes from the repository.

# git status

This shows you your status.

If there are no changes, you can skip directly to git push.

If it says that you "can be fast-forwarded":

# git status
On branch main
Your branch is behind 'origin/main' by 2 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
...

Then you can update with git pull.

Otherwise, if you've diverged:

# git status
On branch main
Your branch and 'origin/main' have diverged,
and have 2 and 3 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
...

Then you can update with git pull --rebase.

If you have local changes, you will need to stash your changes first:

# git stash

And once you're done, recover your changes:

# git stash pop

Finally:

# git push

This pushes your commits to the repository.

Clone this wiki locally