Skip to content. | Skip to navigation

Personal tools


You are here: Home / Wiki / Gitworkflowalt


Getting Started

Alternate version suggested by Kevin showing only the sections that changed, mostly untested. Use GitWorkflow for now

To see changes based on original use Page History and compare to version 1. Major changes are also noted below.

Getting Started

Added extra step to part 3

  1. Create your initial public clone of the main repository by logging into and issuing the following command (replace '<username>' with your account name on git-public):
         git clone --mirror /flux/git/emulab-devel.git /flux/git/users/<username>/emulab-devel.git
    Note: Git will say "Initialized empty Git repository in ..." Do not worry; your new repository is not really empty.
  2. Create your private repository by cloning your public clone on your work machine. You may create as many private repositories in different places as you like, but for this discussion we'll just work with one.
         git clone<username>/emulab-devel.git
  3. Add the main repository as a "remote" of your private repository so that you can publish your work with a 'git push' command. Commits to the main repository will flow through your private clone to your public clone; you will not need to log into git-public to manage your public clone.
         git remote add central
    and add the following to .git/config [XXX: can also use git config]
    [remote "central"]
            pushurl =
            pushurl =<username>/emulab-devel.git
    This will cause any pushes to central to also get pushed to your private clone and thus help keep them in sync.
  4. Initialize a couple of git configuration directives so that git will use your full name and email in commit messages. If you do not do this, it is difficult for others to figure out who has made the commits:
         git config --global "Ryan Jackson"
         git config --global ""
    This will put these settings in ~/.gitconfig, and they'll apply to all future commits from all repositories on that machine. Be sure to do this on any machine you are committing from.
  5. (Optional) Set up your public repository to send mail when you push to it. ... [Not changes from main version]

Normal Work

Simplified most steps

  1. Now, lets do some development work. First, create a branch in your private repository, and push that new branch to your public repository. (You will not push your work to the main repository until your branch is finished.)
         git checkout -b mybranch 
         git push origin mybranch
  2. As you work in the new branch, you should regularly commit your work to the new branch in your private repository.
         git commit -a -m 'Made an important change to foo'
  3. On a regular basis you should also push your changes to your public repository.
         git push
  4. Along the way, you may want to sync up with the main repository to pick up (unrelated) changes by other people.
         git fetch central
    which will grab all changes from central. If you want to merge these changes into your branch, so that your branch has the latest stuff:
         git merge central/master
         git push
    The git push will also push any unrelated changed fetched from central, thus keeping you public clone in sync. [XXX: Make sure this is right]

    If you see a warning message like this:
         CONFLICT (content): Merge conflict in xxx/yyy/zzz
    you will need to resolve those conflicts by hand and mark the conflicts as resolved by re-adding the changed files.
         git add xxx/yyy/zzz
  5. When you are ready to commit your branch to the main repository:
         git checkout master
         git pull central master
         git merge mybranch
         git push central master
  6. Finally, you can delete the branch from your private repository and your public repository.
         git branch -d mybranch
         git push origin :mybranch

Hot Fixes

Removed push to origin as that will happen automatically now

If you want to make a quick change to the central (emulab-devel) repository, without creating a branch in your local clone, first switch back to the master (stashing any local changes on your branch).

     git stash
     git checkout master
     git pull central master

You are now in sync with the emulab-devel repository. Make your change, and then commit locally:

     git commit -a -m "This is a hot fix"

You now need to push this commit to the emulab-devel repository:

     git push central master

Note that this method of making changes is encouraged for small quick fixes only; eg: edit file and commit.