Skip to content

Instantly share code, notes, and snippets.

@washanhanzi
Last active April 20, 2020 17:30
Show Gist options
  • Save washanhanzi/3abf842a8fe80f2bde1c11a04b1e7722 to your computer and use it in GitHub Desktop.
Save washanhanzi/3abf842a8fe80f2bde1c11a04b1e7722 to your computer and use it in GitHub Desktop.

Credentials

  • clear credential cache
git config --global --unset credential.helper
git config --system --unset credential.helper
  • set credential manager (windows)
git config --global credential.helper manager
  • multiple account (windows)
git config --global credential.github.com.useHttpPath true

microsoft/Git-Credential-Manager-for-Windows#749

  • locally store credentials @.git/config
[credential]
    helper = store
  • locally store credentials
git config --global credential.helper store
  • cache credentials expire 15min
git config --global credential.helper cache
  • cache credentials for custom expire time
git config --global credential.helper 'cache --timeout=3600'

User Info

  • global set user info
git config --global user.name "frank"
git config --global user.email "[email protected]"
  • locally user info @.git/config
[user]
    name = frank
    email = [email protected]

Ignore File

@.gitignore

Clear Commits History

git checkout --orphan temp_branch
git add -A
git commit -am "init"
git branch -D master
git branch -m master
git push -f origin master

reset branch and squash commits

git reset origin/dev
git add --all
git commit -m 'my commit message'

clear cache

git rm -rf --cached .

show lines of all file

git ls-files | xargs wc -l

set proxy

git config --global http.proxy http://localhost:7890
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment