Git Cheatsheet

INITIALIZING GIT
git init
	Create an empty git repository or reinitialize an existing one.

git remote add origin https://url.git
	Adds the remote URL at https://url.git to current git repository.

git config --global user.name "John Doe"
	Configures your user name for use by git.

git config --global user.email youraccount@your_email.com
	Configures your email address for use by git.

git config --global core.editor emacs
	Configures your user name for use by git.

git config --list
	Shows global attributes for git.

git config user.name
	Displays a single attribute (user.name, user.email, etc.).



GETTING HELP
git help 
	Uses git's built in help system for help with a command (e.g., config).


UPDATING YOUR REPOSITORY
git add file_name
	Adds file_name to the staging area (will be committed during next
        commit).

git commit -m "Message."
	Records changes from the staging area to the local repository.

git push -u origin master
	Pushes current commits to the remote repository (if one has been added).



DISPLAYING CHANGES
git status
	Displays changes staged and not staged for commit and files
	that are not currently being tracked.

git diff file
	Shows the diff of file and the staging area.  If file is omitted
	git-diff shows a diff of the entire repo.

git log
	Displays the full commit log for the repo.


CHECKING OUT FILES
git clone 
	Creates a local clone of an existing repository.

git checkout 
	Checks out the files in the specified branch.

git checkout  
	Checks out the requested file from the given commit stamp (note changes
	to  that have not been committed will be overwritten).

git pull
	Pulls changes that were pushed to the remote server and merges them with
	the repo on the current machine (does not change the remote).


SPECIAL FILES
.gitignore
	Create in the top-level directory of the git repo.  Tells git what to
	safely ignore.  Example file:
################
#Files to ignore
#Ignore C++ Object Files
*.o
#Ignore Emacs Backups
*~
################


Joshua Guerin