Tips & Tricks with Git

I'll be updating this post with new tips and tricks about git as my personal list of useful commands and configurations.


Rename file

 git mv --force myfile MyFile

source

Setup git local/global config

git config --global user.name 'myusername'  
git config --global user.email 'email@myemail.com'  
git config --global core.editor 'nano'  

source

Add an empty directory to a Git repository

# Ignore everything in this directory
*
# Except this file
!.gitignore

source

Ignore everything except a few files

# Ignore everything
*

# But not these files...
!.gitignore
!myfile.md

source