void routine() {
create;
while(!over){
edit;
save;
}
}
What happened?
Why did it happen?
Who did it?
When?
$ apt-get install git
$ pacman -S git
$ yum install git
brew install git
Setup your username and email first of all to give you credit for the code you are developing.
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
See configuration
$ git config --list
$ git init
path
Initialises a .git directory in your folder
Your files can have three states:
These are the files that are under Git control and are unstaged.
Seeing file status:
$ git status
$ git add <filename> (Add files)
$ git add --all (To add all files)
An example:
$ git add git.c git.h
These files you added to the staging area will be commited to your local database.
After adding all the files you wish to commit just run:
$ git commit
Some examples:
$ git commit -m "Add slide about pushing to a repository"
Your data is now safely stored on your local database.
See all commits
$ git log
Quit with 'q'
To create a branch
$ git branch test
To change branch
$ git checkout test
$ git checkout -b test
Listing all branchs
$ git branch
Do it when you have finished working on your feature, bug fix, etc.
$ git checkout <branch-name>
$ git merge <branch-name>
$ git checkout master
$ git merge test
$ git clone <address>
All commits done? Want to share what you've done?
$ git push origin <branch name>
An example:
$ git push -u origin master
Need to grab what the others did?
This is when to use push.
$ git pull origin <branch name>
An example:
$ git pull -u origin master
$ git pull
$ git help
$ git --help
$ man git
Example: Checking config help
$ git help config
There are also other GUIs created by people outside Github.
There is a full list with download links here.