[core]
editor = nvim
autocrlf = input
ignorecase = false
[pull]
rebase = true
[fetch]
prune = true
[credential]
helper = store
[user]
name = Jim Eckerlein
email = [email protected]
[alias]
c = commit
s = status
a = add .
f = fetch
l = log --all --oneline --graph --tags --color=always
[filter "lfs"]
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
[init]
defaultBranch = main
[advice]
detachedHead = false
git reset --soft @{1}
- Save credentials:
git config --global credential.helper store
- Remove credentials:
git config --global --unset credential.helper
- Log:
git log --all --oneline --graph --tags
- List modified files:
git diff --name-only [commit-old] [commit-new]
- Show remote tracking branches:
git branch -vv
- Set branch upstream:
git branch -u [remote]/[branch]
- Delete remote branch:
git push [remote] --delete [branch]
- Rename branch
git branch -m [new_branch]
git push origin :[old_branch]
git push --set-upstream origin [new_branch]
- Create tag:
git tag [tag]
- Push tag:
git push [remote] [tag]
- Delete remote tag:
git push [remote] --delete [tag]
- Stash away single files:
git stash push -- [file]
- Apply single file from stash:
git checkout stash@{0} -- [file]
- Push commit up to a specific commit:
git push [remote] [commit]:[remote-branch]
- Pull and merge unrelated history:
git pull --allow-unrelated-histories
- Rename a remote:
git remote rename [old-remote] [new-remote]
- Create a patch file:
git diff [commit1] [commit2] > [patch-file]
- Apply patch:
git apply [patch-file]
- Cleanup garbage:
git gc
- Convert crlf to lf on check-in, checkout lf:
git config --global core.autocrlf input
- Disable default fast-forward merge:
git config --global merge.ff false
- Enable default rebasing when pulling:
git config --global pull.rebase true
Update fork including tags:
git remote add upstream [email protected]:user/repos.git
git fetch upstream
git rebase upstream/master
git push
git push --tags
I'm not really sure which steps are actually required.
ssh-keygen -t rsa -b 4096 -C [email]
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
- Add key from
cat ~/.ssh/id_rsa.pub
to Github account (Settings
>SSH and GPG keys
).