Skip to content

Instantly share code, notes, and snippets.

@tajidyakub
Last active October 30, 2022 18:59
Show Gist options
  • Save tajidyakub/f2ad2cd881d1f055169583a1fa1897b3 to your computer and use it in GitHub Desktop.
Save tajidyakub/f2ad2cd881d1f055169583a1fa1897b3 to your computer and use it in GitHub Desktop.
Useful git command and configuration.

Useful git Command and Configuration

Simple cheatsheet

Clone, init, add, commit

  • If clone $ git clone [url]
  • Initialize directory $ git init
  • Add files $ git add . will add current directory
  • To commit use $ git commit -m"[commit message]"
  • Add and commit $ git commit -am "[commit message]"

Collaborate

  • Show remote -details $git remote -v

To globally ignore specific folder file type

Example : Ignore .DS_Store, .vscode and vendor globally

  • Create global gitignore somewhere eg: ~/.gitignore_global
  • Insert ignored pattern in that file
  • Set git to globally use the file
$ touch ~/.gitignore_global
$ echo .DS_Store >> ~/.gitignore_global
$ echo .vscode >> ~/.gitignore_global
$ echo vendor >> ~/.gitignore_global
$ git config --global core.excludesfile ~/.gitignore_global

Reference :

References

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