Git useful commands

  • Lets disable file mode and signature
git config --replace-all core.filemode false
git config --replace-all commit.gpgsign false
  • Store all your cred into system helper
git config --replace-all --global credential.helper store
# Set the cache to timeout after 1 hour (setting is in seconds)
git config --replace-all --global credential.helper 'cache --timeout=3600'
  • Let's check why this path is ignored by the git tracking
git check-ignore -v /absolute/path/to/directory
  • Ignore file mode change in current working tree
# For individual project
git config core.fileMode false 
# For system wide all git project
git config --global core.fileMode false
  • Reset current branch to previous stat
git reset --hard HEAD
  • How to save your work into git clipboard
git stash
  • Easy way to update your current code using same branch.
git pull --rebase

Final my .gitconfig file looks like

cat ~/.gitconfig
[user]
    email = [email protected]
    name = Vallabh Kansagara
[credential]
    helper = store
[core]
    fileMode = false

Tags: linux, git

Related posts