Skip to content

Commit

Permalink
Merge pull request denisidoro#17 from d3d1rty/git-cheatsheet
Browse files Browse the repository at this point in the history
This PR adds additional cheats to the git cheatsheet.
  • Loading branch information
denisidoro authored Sep 21, 2019
2 parents d517fa6 + 442b6d0 commit f1fee67
Showing 1 changed file with 52 additions and 4 deletions.
56 changes: 52 additions & 4 deletions cheats/git.cheat
Original file line number Diff line number Diff line change
@@ -1,13 +1,61 @@
% git

# Clear everything
git clean -dxf
# Set global git user name
git config --global user.name "<name>"

# Sign all commits in a branch based on master
git rebase master -S -f
# Set global git user email
git config --global user.email "<email>"

# Initializes a git repository
git init

# Adds a remote for a git repository
git remote add <remote name> <remote URL>

# Checkout to branch
# Change branch
git checkout <branch>

$ branch: git branch --format='%(refname:short)'

# Displays the current status of a git repository
git status

# Displays the changes made to a file
git diff <filename>

# Stages a changed file for commit
git add <filename>

# Stages all changed files for commit
git add .

# Saves the changes to a file in a commit
git commit -m "<commit message>"

# Pushes committed changes to remote repository
git push -u <remote name> <branch name>

# Pushes changes to a remote repository overwriting another branch
git push <remote name> <branch>:<branch to overwrite>

# Overwrites remote branch with local branch changes
git push <remote name> <branch name> -f

# Pulls changes to a remote repo to the local repo
git pull --ff-only

# Merges changes on one branch into current branch
git merge <branch name>

# Displays log of commits for a repo
git log

# Displays formatted log of commits for a repo
git log --all --decorate --oneline --graph

# Clear everything
git clean -dxf

# Sign all commits in a branch based on master
git rebase master -S -f

0 comments on commit f1fee67

Please sign in to comment.