Working with branches: --------------------- git branch Show all branches in the working directory. git checkout Switch to branch. git ls-tree -r --name-only Check contents of branch git checkout -b Creates a branch and switches to it. git branch -d Delete branch. Git upload workflow: |Working directory| <--(reset)...(add/remove)--> |Index| --(commit)--> |Head| --(push)--> |Remote directory| ------------------- git add Add file to the Index. git add * Add all files to the Index. git rm Removes file from Index and Working directory. git mv Rename file at Index and Working directory. git reset Removes all changes to the git Index. git status Summarizes pending changes to be commited. git diff Looks for possible conflicts between added file and previously commited files to branch. git commit -m "Commit message" Commit files in the index to the HEAD. git diff Looks for possible conflicts before merging branches. git merge Merges another branch into the active branch. git push origin master Send changes to remote repository. Change master to whatever branch you want to push changes to. Git download workflows: ---------------------- 1. |Remote directory| --(clone)--> |Working directory| git clone username@host:/path/to/repository Create a working copy of a remote repository. 2. |Remote directory| --(fetch_reset/pull)--> |Head| git fetch origin; git reset --hard origin/master Fetches the latest history from the server, drops all local changes and all commits. git pull Updates the local repository to the newest commit. Pull = (fetch of remote changes + merge with local changes)! 3. |Head| --(checkout)--> |Working directory| git log --name-status Visualizes the files that have changed in each commit. git checkout -- Replaces files in the working tree with the last contents in HEAD. Changes already added to the index, as well as new files, will be kept. Legend for uncommited changes (Synchronize Index to current state of Working directory): --------------------------------------------------------------------------------------- M = modified A = added D = deleted R = renamed C = copied U = updated but unmerged http://rogerdudler.github.io/git-guide/