Git notes
Some notes, predominantly so I can remember, of how to use github from the command line.
New repository
To create a new repository:
git init
Clone repository
To clone an existing remote repository:
git clone <full repository path>
Add
Add a specific change:
git add <filename>
Add all changes:
git add *
Commit
To commit changes:
git commit -m "Commit message"
The file is commited to HEAD, but not to the remote repository.
Pushing
To push changes from HEAD to the remote repository:
git push origin master
Updating
To fetch and merge remote changes (i.e. updating your local repository):
git pull
Git auto-merges changes, which won’t necessarily be possibly if there any conficts. You’ll be required to manually resolve (edit) files in the case of conficts.
An alternative to pull, is to use fetch.
git fetch