~$ cd MySources
MySources$ git clone d.gpio.dk:BDash
Cloning into 'BDash'...
remote: Counting objects: 43, done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 43 (delta 17), reused 0 (delta 0)
Receiving objects: 100% (43/43), 105.56 KiB, done.
Resolving deltas: 100% (17/17), done.
MySources$ git clone d.gpio.dk:BDash
Cloning into 'BDash'...
remote: Counting objects: 43, done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 43 (delta 17), reused 0 (delta 0)
Receiving objects: 100% (43/43), 105.56 KiB, done.
Resolving deltas: 100% (17/17), done.
Receive sources from server, but choose a new name for the project directory:
MySources$ git clone d.gpio.dk:BDash BoulderDash
Cloning into 'BoulderDash'...
Cloning into 'BoulderDash'...
Add your existing project to a repository:
~$ cd MySources/MyProject
MyProject$ git init
Initialized empty Git repository in /Users/bob/MySources/MyProject/.git/
MyProject$ git remote add origin d.gpio.dk:MyProject
MyProject$ git add *
MyProject$ git commit -a -m "initial sources"
MyProject$ git push --set-upstream origin master
Note: You (or the admin) must create the repository first!MyProject$ git init
Initialized empty Git repository in /Users/bob/MySources/MyProject/.git/
MyProject$ git remote add origin d.gpio.dk:MyProject
MyProject$ git add *
MyProject$ git commit -a -m "initial sources"
MyProject$ git push --set-upstream origin master
Everyday use...
Before you start editing your sources, it might be a good idea to get the latest changes, to avoid conflicts:
~$ cd MySources/MyProject
MyProject$ git pull
MyProject$ git pull
When you've made some changes, and tested that there are no compile-errors (or the like), it's a good idea to submit these changes:
MyProject$ git commit -a -m "Fixed bug in calculating the distance between the two ships."
MyProject$ git push
Note: Commit + push often = easiest life, and the server also works as a backup or a big undo-buffer.MyProject$ git push
This is a very useful alias; it allows you to 'undo' a git add:
git config --global alias.unstage 'reset HEAD --'
If you want the tab width (aka tab-size) for diff to be 4 characters, you can use this:
git config --global core.pager 'less -x1,5'