Git Client Setup

From Lyra

Jump to: navigation, search

Contents

General Info

Synchronization Server is camel-ece.bu.edu

The Impatient Developers Guide

1. Set up absolute minimum config

git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com

2. Initial import from sync server

git clone ssh://camel-ece.bu.edu/home/git rfsm-git

3. Make changes and commit them

cd rfsm-git
git commit -a -m "MY LOG MESSAGE"

4. Get changes that have happened on server

git pull

5. Push Changes to server

git push

The Long Way Around

Using Git

Git is different from CVS. The fundamental idea behind it is that you have a full copy of the repository, which you can think of as your own local repo. Changes you make to your local clone will not be reflected in the remote repository unless you specify explicit remote operations. When you are done making changes, and ensure the code works, then push your changes to the synchronization repository.

Do NOT push to the sync repository unless you are sure your changes are all done and work fine. Make sure the sync repository is never in a broken state from your commit.

Further, the synchronization repository is set up to send emails when changes are pushed to it.

Local vs Remote

Git is a ditributed version control system. This means that once you have a initial copy of the repository, you can use version control locally. Such commands wont contact the server, and as a result, commits will not be reflected to the server. You can make an update to the server, using remote commands. Here is a quick list of the remote commands you will need:

  1. git clone
  2. git push
  3. git pull

Local User Configuration

The following are essential parts of the configuration. As the command implies, these setup global settings, which are used for all git repositories. These configs are stored in ~/.gitconfig It is crucial that your name and email be entered as git automatically tags log entries with them. The last 3 options are for coloring output of git commands. These are helpful if you do a lot of work from the command line.

git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto

Client Initial Import

Run the following to obtain a clone of the repository on the sync server. This is roughly the equivalent of doing a checkout from the cvs server. The following commands need to be run in a git repository.

git clone ssh://hippo-ece.bu.edu/home/git rfsm-git

Working Locally

You can work in the rfsm-git folder.

To add new files to version control

git add $FILE_NAME

To check the status of files

git status

To revert a modified file file to the last locally committed version

git checkout $PATH

To commit all changes

git commit -a
NOTE:: You MUST give a log entry for every commit, either with the -m parameter, or in the window that appears.


Working Remotely

When you are done with local changes and want to commit to the sync server, or when the sync server is updated, you should use the remote commands.

Updating from sync server

To update your working copy from the sync server, run the pull command. It is recommended you do this prior to pushing changes to the sync server so you can resolve conflicts.

git pull

Pushing to the sync server

To push your working copy, run the push command. This will update the sync repository with your updates and send an email to the dev group with your commit. Please keep the following in mind.

  1. Do Not break the code on the sync server. Make sure the code you are pushing works before you send it to the sync server
  2. Try and do a pull from the server before doing a push and resolve any conflicts that arise locally, before pushing
git push

Sources

Remote Git

SVN to Git

CVS to Git

Personal tools