Skip to content

Instantly share code, notes, and snippets.

@FMassin
Last active March 23, 2017 15:08
Show Gist options
  • Save FMassin/aaf0e7a5937cea3f327c61f5b0f3a4b7 to your computer and use it in GitHub Desktop.
Save FMassin/aaf0e7a5937cea3f327c61f5b0f3a4b7 to your computer and use it in GitHub Desktop.
Cheetsheat

Table of Contents

  1. start
  2. routine operations
  3. ignore
  4. Delete

Start

Set

Omit --global to apply to the current project only.

Set identity

git config --global user.name "John Doe"
git config --global user.email johndoe@example.com

Set editor

git config --global core.editor emacs

Set how long the password is cached

git config --global credential.helper 'cache --timeout=60'

Routine operations

Pull or push from spec. url

git pull <URL>
git push <URL> master

Add and commit all files

git add -A && git commit --author="NAME <EMAIL>"

Get an previous version

git checkout <commit hash>

Go back to last version

git checkout master

Ignore

Ignore in current project

Edit .gitignore with file patterns to ignore (a good .gitignore).

Ignore system-wise

git config --global core.excludesfile ~/.gitignore_global

Ignore committed file (untrack)

git rm --cached <FILENAME>

Delete last commit

Delete last commit

git reset --soft HEAD~1

Delete actual changes

git reset --hard HEAD~1

If already pushed

git revert HEAD

If not last

git log
git reset --hard <sha1-commit-id>

Patch

Create a patch

Explore a patch

git apply --stat <patch>

Check a patch

git apply --check <patch>

Apply a patch

git am --signoff < <patch>

Tests

Are packets in the future ?

slinktool -Q localhost:18000|sed 's; ; 00 ;'|while read N S L C T D1 T1 t D2 T2; do NOW=$( date +"%T" ); if [[ $NOW<$T2 ]] ; then echo $N $S $L $C $NOW \< $T2 ;fi ;done

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