GIT Cookbook for TMBIDL

Initialization

The TMBIDL repository is located at BU on tmbidl.bu.edu. This is where the master code resides. To initialize TMBIDL on your local machine please perform the following steps:

  1. Set up git on your local machine. This information is logged and attached to any changes to the repository.
    • $ git config --global user.name "Your Name"
    • $ git config --global user.email email_at_address.com
    • $ git config --global push.default matching
  2. Create a place to install TMBIDL. Note that it must be an empty directory. You can copy things (like data, sandbox procedures, startup procedures, COMPILE and INIT files) to it once TMBIDL is installed from the repository.
    • $ cd /where/you/want/to/put/it
    • $ mkdir tmbidl
  3. Clone the current version of TMBIDL from the repository using your username and password. The repository is located at github.
    • git clone git@github.com:bostonu-cas/tmbidl.git . <-- assuming your are in the tmbidl directory (N.B., the dot at the end)
  4. Update your version of TMBIDL.INIT.TCSH located in v7.0/startup:
    • IDL_PATH-> points to normal IDL path on your machine
    • LOCAL_IDL-> points to the TMBIDL installation
  5. Create alias to start program. For example:
    • alias inittmbidl='cd /tmbidl/v7.0/startup/ ; source TMBIDL.INIT; idl ; cd -'
  6. TMBIDL is now installed.

Making Changes

Most interaction with GIT will involve only two actions. To push changes to the repository or to pull changes from the repository. Except for the gatekeeper, only sandbox changes should be pushed to the repository.

  1. To send changes to the repository:
    • $ cd /where/you/put/it/tmbidl
    • $ git add -u path/to/add <-- can be either a file or a directory
    • $ git commit -m 'info about change'
    • $ git push origin master
  2. To update to the most recent version of TMBIDL (i.e., copy changes to other people's sandboxes, update to newer version, etc.)
    • $ cd ~/tmbidl
    • $ git pull origin master

Rollback

Let's say something was pushed to the master and then pulled by you. Let's say these changes messed something up. Here is how you "rollback":

  • Use "git log" to find out which commit you want to roll back to.

$ git log
commit 731175b87b43519358cf3ef0c4622d8bedafe44a
Author: tom bania <bania@bu.edu>
Date:   Mon Jul 29 15:29:59 2013 -0400

    attach.pro bug fix

commit dbd1f78dad15fd5ec826460f7962ae3cb70f6e37
Author: tom bania <bania@bu.edu>
Date:   Thu Jul 25 15:17:15 2013 -0400

    tmb tweaks and lda bug fixes

commit 46c9cfb4e75e300335a7d605ebea1d1940b9dc67
Author: loren <loren.dean.anderson@gmail.com>
Date:   Thu Jul 25 12:46:49 2013 -0400

    updated lda sandbox

commit 27f7f7c9904aa64e4403e924d149f4f0ca372e26
Author: loren <loren.dean.anderson@gmail.com>
Date:   Thu Jul 25 12:46:42 2013 -0400

    updated lda sandbox

commit bdb004f954239b34b51f211e6426cac72456b820
Author: loren <loren.dean.anderson@gmail.com>
Date:   Thu Jul 25 12:46:29 2013 -0400

    updated lda sandbox

  • Let's say we want to go back to the commit "tmb tweaks and lda bug fixes". To do so, we issue the git reset --hard command:

$ git reset --hard dbd1f78dad15fd5ec826460f7962ae3cb70f6e37
HEAD is now at dbd1f78 tmb tweaks and lda bug fixes

  • Check that we are at the correct place:

$ git log
commit dbd1f78dad15fd5ec826460f7962ae3cb70f6e37
Author: tom bania <bania@bu.edu>
Date:   Thu Jul 25 15:17:15 2013 -0400

    tmb tweaks and lda bug fixes

commit 46c9cfb4e75e300335a7d605ebea1d1940b9dc67
Author: loren <loren.dean.anderson@gmail.com>
Date:   Thu Jul 25 12:46:49 2013 -0400

    updated lda sandbox

commit 27f7f7c9904aa64e4403e924d149f4f0ca372e26
Author: loren <loren.dean.anderson@gmail.com>
Date:   Thu Jul 25 12:46:42 2013 -0400

    updated lda sandbox

commit bdb004f954239b34b51f211e6426cac72456b820
Author: loren <loren.dean.anderson@gmail.com>
Date:   Thu Jul 25 12:46:29 2013 -0400

    updated lda sandbox

commit 9429df1f59dee33d928d14fc2601a8951a1594d0
Author: loren <loren.dean.anderson@gmail.com>
Date:   Wed Jul 24 15:48:01 2013 -0400

    updated lda sandbox

  • Get back up to date.

$ git pull origin master
twenger@tmbidl.bu.edu's password: 
From tmbidl.bu.edu:/tmbidl/tmbidl
 * branch            master     -> FETCH_HEAD
Updating dbd1f78..731175b
Fast-forward
 v7.0/pro/attach.pro |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

  • Check that we are back up to date:

$ git log
commit 731175b87b43519358cf3ef0c4622d8bedafe44a
Author: tom bania <bania@bu.edu>
Date:   Mon Jul 29 15:29:59 2013 -0400

    attach.pro bug fix

commit dbd1f78dad15fd5ec826460f7962ae3cb70f6e37
Author: tom bania <bania@bu.edu>
Date:   Thu Jul 25 15:17:15 2013 -0400

    tmb tweaks and lda bug fixes

commit 46c9cfb4e75e300335a7d605ebea1d1940b9dc67
Author: loren <loren.dean.anderson@gmail.com>
Date:   Thu Jul 25 12:46:49 2013 -0400

    updated lda sandbox

commit 27f7f7c9904aa64e4403e924d149f4f0ca372e26
Author: loren <loren.dean.anderson@gmail.com>
Date:   Thu Jul 25 12:46:42 2013 -0400

    updated lda sandbox

commit bdb004f954239b34b51f211e6426cac72456b820
Author: loren <loren.dean.anderson@gmail.com>
Date:   Thu Jul 25 12:46:29 2013 -0400

    updated lda sandbox

Useful Aliases

  1. Push sandbox to master
    • alias sandboxpush "cd /idl/tmbidl ; git add -u /idl/tmbidl/sandboxes/tvw/ ; git commit -m 'updated tvw sandbox' ; git push origin master ; cd -"
  2. Pull from master
    • alias tmbidlupdate "cd /idl/tmbidl ; git pull origin master ; cd -"

GIT Cheat Sheet (see http://zrusin.blogspot.com/2007/09/git-cheat-sheet.html)

git-cheat-sheet-medium.png

-- DanaBalser - 2013-06-12

Topic attachments
I Attachment Action Size Date Who Comment
git-cheat-sheet-large.pngpng git-cheat-sheet-large.png manage 1 MB 2013-06-12 - 17:20 DanaBalser GIT Cheat Sheet (large)
git-cheat-sheet-medium.pngpng git-cheat-sheet-medium.png manage 335 K 2013-06-12 - 17:17 DanaBalser GIT Cheat Sheet
Topic revision: r6 - 2014-05-19, DanaBalser
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback