An open API service indexing awesome lists of open source software.

https://github.com/spiderpig86/gitstuffdone

:blue_book: Common git commands simplified.
https://github.com/spiderpig86/gitstuffdone

cheatsheet git git-cheatsheet git-guide github

Last synced: 6 months ago
JSON representation

:blue_book: Common git commands simplified.

Awesome Lists containing this project

README

          

# GitStuffDone
Simple git reference for when I forget.

## :tada: Creating Repositories
* `git init` - create a new repo
* `git clone ` - download a project to a custom folder
* `git status` - check repo status

## :date: Repo History
* `git log` - display commit ID (SHA), author, date, and commit message
* `j`(up), `k`(down), `q`(exit) - scrolling through commit history
* `git log --stat` - view modified files
* `git log -p` or `git diff` - view file changes in commit
* `git log -p --stat` - view both modified files and file chanegs
* `git show ` - view file changes of specific SHA id
* `git show SHAid --state` - view modified files of specific SHA
* `git log --stat ` - view specific commit by ID

## :heavy_plus_sign: Adding
* `git add .` - add all files in current directory to stage
* `git add ` - add specific files to stage
* `git add -u` - add all tracked files

## :pushpin: Committing
* `git commit -m ` - write a commit message without using the text editor
* Guideline: https://udacity.github.io/git-styleguide/
* `git commit` - write commit message with text editor opened
* `git commit -a` - directly add files to the repo without going through staging

## :scissors: GitIgnore
* Note: Assumes that VSCode is installed.
##### Linux / OSX / GitBash
1. Run `touch .gitignore` to create a file
2. Run `code .gitignore` to open and edit

##### Windows Powershell
1. Run `New-Item .gitignore -type file` to create a file
2. Run `code .gitignore` to open and edit

##### Windows CMD
1. Run `copy NUL .gitignore` to create a file
2. Run `code .gitignore` to open and edit

## :tropical_fish: Tagging
* `git tag` - check version of tag in command line
* `git tag -a ` - write a message for a specific version of the file
* `git log --decorate` - show the current branch and tag version
* `git tag -d - delete tag version
* `git tag -a ` - add a tag for a specific commit by SHA id.

## :herb: Branching
* `git branch` - show current branch
* `git branch ` - create a new branch
* `git checkout ` - switch to another branch
* `git log --oneline --decorate` - display current active branch with SHA id and commits only
* `git branch -d ` - delete branch by name
* `git checkout -b ` - create new branch and switch to it
* `git checkout -b master` - create a new branch in the same location as the master branch and switch to it
* `git log --oneline --decorate --graph --all` - display all branches in folder

## :page_with_curl: Merging
* `git reset --hard HEAD^` - undo branch merge
* `git merge ` - merge branch by name

## :heavy_check_mark: Correcting
* `git commit --amend` - correct commit details in branch
* `git revert ` - revert changes up to commit specified by id

## :milky_way: Remote
* `git remote add origin ` - add a remote url for the repository
* `git remote set-url origin ` - set a specific url for the repository
* `git remote -v` - check the push and pull locations