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:
Modified Staged CommitedThese are the files that are under Git control and are unstaged.
Seeing file status:
$ git statusAfter you've done your changes, you can stage files with:
$ git add <filename> (Add files) $ git add --all (To add all files)An example:
$ git add git.c git.hThese 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 commitSome 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 logQuit with 'q'
To create a branch
$ git branch testTo change branch
$ git checkout testOr better yet!
$ git checkout -b test
Listing all branchs
$ git branch
Do it when you have finished working on your feature, bug fix, etc.
Change to the branch you wish to merge your work
$ git checkout <branch-name>Merge the changes
$ git merge <branch-name>An example
$ 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.