Skip to content

Instantly share code, notes, and snippets.

@witt3rd
Last active September 24, 2020 20:13
Show Gist options
  • Save witt3rd/01e459b2a259b12f314f51ae0dfee2f4 to your computer and use it in GitHub Desktop.
Save witt3rd/01e459b2a259b12f314f51ae0dfee2f4 to your computer and use it in GitHub Desktop.
Tips and commands for using Git and Github

Git and Github

Git

Listing the files in a commit

git diff-tree --no-commit-id --name-only -r 289b092d

Clearing Git History

From an entire branch

From the branch you wish to clear history of (e.g., master):

git checkout --orphan temp_branch
git add -A
git commit -am "The first commit"
git branch -D master
git branch -m master
git push -f origin master

During a merge

From the branch you want to merge TO:

git merge from_branch --squash

Tagging

A specific commit

git tag -a v1.0 5d80d -m "release v1.0"
git push origin --tags

Deleting

git tag -d v1.0
git push origin -d v1.0

Submodules

Cloning

After cloning a repo that contains submodules, git will not automatically fetch them. Instead, you must:

git submodule init
git submodule update

Github

Github Pages

git clone git@github.com:witt3rd/witt3rd.github.io.git

Jekyll

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