See ‡ README section (bottom) for install notes
- [ ] https://github.com/kamranahmedse/git-standup
- [ ] Learning git.txt - nvALT
- [ ] setup org-drill
- [ ] Place key in github
- [ ] git lol
- Diff what is staged
git diff --staged
- Diff between dates
git diff [--stat] @{2017-03-01}..@{2017-04-01}
- Temporarily ignore changes in file (then undo)
git update-index --assume-unchanged <file> git update-index --no-assume-unchanged <file>
- See what has changed
git log --since="1 week ago" --until="1 day ago" -p
- init a repo
git init
- Add empty folder
- Add .gitignore to folder with:
* !.gitignore
- Add .gitignore to folder with:
- Unstage files
git reset <filePath>
- stop tracking a file (and start again)
git update-index --assume-unchanged [<file> ...] git update-index --no-assume-unchanged [<file> ...]
- List git aliases
git config --get-regexp alias
- git lol alias
git config --global --add alias.lol "log --graph --decorate --pretty=oneline --abbrev-commit --all"
- create branch
git branch <branch>
- delete branch
git branch -d <branch>
- push branch and remember destination so you can just do ‘git push’ next time
git push -u origin <branch>
- Remove every line from history matching sed
git filter-branch --tree-filter 'sed -i "/sensitive information/ d" filename' -- --all
- if you know the first commit
git filter-branch --tree-filter 'sed -i "/sensitive information/ d" filename' <commit>..HEAD
- if you know the first commit
- Remove every line from history that has word
git filter-branch --tree-filter "find . -type f -exec sed -i -e '/$*word/d' {} \;"
- change password in every commit to new string
git filter-branch --tree-filter "find . -type f -exec sed -i -e 's/originalpassword/newpassword/g' {} \;"
- check for data
git filter-branch --tree-filter "grep -r originalpassword * || true"
- remove file from history
git filter-branch -f --tree-filter 'rm -f full/path/file.js' HEAD
- Backs ups are in .git/refs/original and can be removed (just one or all refs)
git update-ref -d refs/original/refs/heads/master git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
- Reattach head at point
git checkout <sha> git branch my-new-branch -f
- Renaming an author
- Pull versions of files from a branch
git checkout branch -- path path path
- Add a file you forgot in the last commit
git add file-that-i-forgot.txt git commit --amend --no-edit
- Put a commit “on top” of current point
git rebase -i commit
- delete file from git and disk
git rm path
- remove untracked files (Reset directory to HEAD)
git clean -fd
- change remote to ssh so that it doesnt ask for password
git remote set-url origin [email protected]:joegle/git-notes.git
- Stored in
.git/config/
- Stored in
- View existing remotes
git remote -v
- List untracked files
git ls-files . --exclude-standard --others
- List ignored files
git ls-files . --ignored --exclude-standard --others
- Check if all branches are up to date with remote
git remote -v update
- [ ] bash completion
- [ ] git prompt
- [ ] git so fancy
- [ ] add keys directions
- [ ] https://github.com/git-tips/tips