Skip to content

Instantly share code, notes, and snippets.

@paxcodes
Last active May 7, 2021 02:09
Show Gist options
  • Save paxcodes/8570c1abef91699d44976f9ebf1f9bc4 to your computer and use it in GitHub Desktop.
Save paxcodes/8570c1abef91699d44976f9ebf1f9bc4 to your computer and use it in GitHub Desktop.
git commands for contributing to open source projects

See Aliases for actual commands

Git Commands

Create your dev branch from an upstream branch and checkout

git co -b my_feat_or_bugfix upstream/main

Create branch of same name from remote branch and checkout

git co -t <remote_server>/<remote_branch>

Create branch of same name from remote branch without checking out

git branch -t <branch_name> <remote_server>/<branch_name>

Set up your repository so git pull pulls from upstream by default

Assuming the repo has branch main

git config branch.main.remote upstream
git config branch.main.merge refs/heads/main

Aliases

alias.co checkout
alias.st status
alias.ci commit -v
alias.ph push
alias.pl pull
alias.mg merge
alias.mgnf merge --no-ff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment