Adding
Suppose you add new files to a local repo under version control - you need to let Git know that they need to be tracked
- git add . adds all new files
- git add -u updates tracking for files that changed names or were deleted
- git add -A does both
- You should do this before committing
Committing
- You have changes you want to commit as an intermediate version
- You type the command git commit -m "message" where message is a useful description of what you did
- This only updates your local repo, not the remote repo on GitHub
Pushing
- You have saved local commits you would like to update on the remote (GitHub)
- You type the command git push
Branches
- Sometimes you are working on a project with a version being used by many people
- You may not want to edit that version, so you create a branch with the command git checkout -b branchname
- To see what branch you're on: git branch
- To switch back to the master branch: git checkout master
Pull requests
- If you fork someone's repo or have multiple branches, you will both be working separately
- Sometimes you want to merge in your changes into the other branch/repo
- To do this, you need to send a pull request
- This is a feature of GitHub
Git documentation can be found here.
More GitHub help can be found here.