Skip to content

Instantly share code, notes, and snippets.

@barnes7td
Last active April 7, 2019 19:32
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save barnes7td/04624e4a25751578662d6306b7cb8529 to your computer and use it in GitHub Desktop.
Save barnes7td/04624e4a25751578662d6306b7cb8529 to your computer and use it in GitHub Desktop.
Basic Git Terms and Workflows
Display the source blob
Display the rendered blob
Raw

Checkpoint:

git checkout -b branch-name
git status (use often as needed)
git add .
git commit -m "Description"

git checkout master
git merge branch-name
git push origin master

git branch -d branch-name

Assignment:

git checkout -b branch-name
git status (use often as needed)
git add .
git commit -m "Description"

git push origin branch-name
git checkout master

#IF TOLD TO MERGE ASSIGNMENT
git merge branch-name
git push origin master

git init - Create a repo from scratch.

git clone - Copy a repo from GitHub or other remote repo.

git add - Track and stage files or stage already tracked file changes to your local repo.

git commit - Commit (Save changes as a record) to the local repo.

git merge - Copy commits from another branch onto current branch.

git checkout - The command to switch between branches.

git branch - create a branch, or list branches (-a).

git push - Send local changes on a branch to GitHub (or other remote repo).

git pull - Get remote changes from a branch on GitHub and merge to your local repo.

git remote - List remote repo addresses (like GitHub).

git status - Check the current state of the repo.

Single Person Pull Request Workflow

Terminal:

git checkout -b branch-name
git status (use often as needed)
git add .
git commit -m "Description"

git push origin branch-name"

GitHub:

  • [GH] - Go to main page, and click Pull Request button (green, not always there).
  • [GH] - PR form, fill out (optional), click Submit .
  • [GH] - Go to PR in "Pull Requests" tab
  • [GH] - "Conversation" tab, click button to accept the PR. (confirm? yes)

Terminal:

git pull origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment