GETTING STARTED Here are some initial things which are good to setup before you start using Git e.g. with a GUI. Git uses these to identify you when you make changes: $ git config --global user.name "Richard E. Turner" $ git config --global user.email "richard.e.turner@gmail.com" Check this $ config user.name (global sets for all projects) Set the text editor $ git config --global core.editor 'emacs' $ cd myproject $ git init Creates a .git directory which is the repository $ git add . $ git commit -m 'initial commit' $ git log To see all the changes. After the first commit you can use qgit to manage the project. SYNCHRONISING TO NYU Here's the way I've done this - in addition to the copy of the repository on my local machine, it involves a copy on my NYU file space which I can PUSH changes to, and a separate copy on NYU which I run my simulations from. So, in total there are three repositories. local working <-> NYU bare <-> NYU working To set this up, first create a local `bare' copy of the repository: $ git clone --bare myproject baremyproject A bare repository does not have a working directory - this is the only type of repository it is possible to push into. We need a repository to push to as we can't easily pull from my laptop to the NYU repo. (you can't see your laptop from the NYU file system). zip up the bare project $ zip bareproj.zip bareproject -r move this to your NYU webspace and unzip it $ unzip bareproj.zip now go back to the original repository, you can push changes via: $ git push /locationofNYUbarecopy/ This last step relies on having mounted NYU using sshfs (see below) I now clone the bare repository on my NYU space to make a third repository with a working directory, from which I can run simulations etc. $ git clone mybareproject myproject Now we have setup the following: local working <-> NYU bare <-> NYU working work flow is as follows: from the local working we push and pull to NYU bare from the NYU working we push and pull to NYU bare MOUNTING YOUR NYU FILE SPACE AS A LOCAL DIRECTORY let username = you user name localmountpoint = where you want your NYU files to appear: $ sshfs -o workaround=rename username@annio.cns.nyu.edu:/users-lcv/username localmountpoint BRANCHING AND MERGING Branching and merging are super-useful when developing code. Here are some steps to setup a new branch and merge it back into the old one. Look at the current branches: $ git branch Create a new branch $ git branch newbranch Look at branches and currently active branch: $ git branch Currently active branch is starred Switch to the new branch $ git checkout newbranch To check that we've selected the new branch: $ git branch Check that newbranch is starred. If you add/modify files, then they will appear only in the selected branch of the repo. To merge one branch into another, switch to the branch you want to merge into (e.g. via $ git checkout master) and then run: $ git merge newbranch TO IGNORE CERTAIN FILES: edit the file .git/info/exclude TO REMOVE A FILE FROM THE REPOSITORY: $ git rm filetoremove TO MOVE/RENAME A DIRECTORY $ git mv oldName newName you then have to commit the change - don't use mv directly.