Skip to content

Commit

Permalink
Initial commit; minor edits to formatting and separated Terminal comm…
Browse files Browse the repository at this point in the history
…ands into their own section
  • Loading branch information
gav1 committed Jul 8, 2018
1 parent 89481b9 commit f710411
Showing 1 changed file with 30 additions and 18 deletions.
48 changes: 30 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,35 @@

A cheatsheet of Git commands.

- [cd, ls](#navigate)
- [cd, ls](#terminal-navigation)
- [git init, git config](#git-setup)
- [status, log](#state-checking)
- [editor](#git-editor)
- [git remote](#remote-branch)
- [git add, git commit](#add-and-commit)
- [delete local and remote branch](#delete-local-and-remote-branch)

## navigate
## terminal navigation

* navigate to a particular folder
```bash
cd "<path>"
```

* navigate up a folder
```bash
cd ..
```

* navigate to your home folder
```bash
cd
```

* list items in current folder
```bash
ls
```
* check git status
```bash
git status
```
* check git log
```bash
git log # too verbose
git log --oneline # condenses to a single line
git log --oneline -n 5 # prints only the last 5 commits
```

## git setup

Expand All @@ -45,25 +39,43 @@ git log --oneline -n 5 # prints only the last 5 commits
cd "<desired-path>"
git init
```

* check global and local git settings
```bash
git config --global -l
git config --local -l
```

* configure global git settings (cd anywhere)
```bash
git config --global user.name "<full-name>"
git config --global user.email "<email>"
git config --global core.editor "nano -w"
```

* configure local git settings
```bash
cd "<desired-path-for-local-settings>"
git config --local user.name "<local-full-name>"
git config --local user.email "<local-email>"
```

### git editor
## state checking

* check git status
```bash
git status
```

* check git log
```bash
git log # too verbose
git log --oneline # condenses to a single line
git log --oneline -n 5 # prints only the last 5 commits
```

## git editor

* check editor version and run
```bash
nano --version
Expand All @@ -74,15 +86,15 @@ emacs --version
emacs
```

### remote branch
## remote branch
```bash
git remote -v
# the remote branch is named origin in this example
git remote add origin <https-origin-url>
git remote set-url origin <https-origin-url>
```

### add and commit
## add and commit
```bash
# add
git add <file.ext>
Expand All @@ -91,8 +103,8 @@ git add . # danger, this stages all changes
git commit -m "Message"
```

### delete local and remote branch
## delete local and remote branch
```bash
git branch -d <local-branch-name>
git branch -D <local-branch-name>
git push origin :<remote-branch-name>
```
```

0 comments on commit f710411

Please sign in to comment.