Assuming you've set up a working git repository, the typical work flow is as follows:
  1. In your private repo, move to the branch you wish you branch off of,
    • git checkout parent_branch_name
  2. create a new branch off this parent, using one of the following sequences:
    1. if on the parent branch, create the branch then switch to it:
      • git branch new_branch_name
      • git checkout new_branch_name
    2. same as above, but done in a single command
      • git checkout -b new_branch_name
    3. same as above, but done on a non-parent branch
      • git checkout -b new_branch_name parent_branch_name
  3. on your new branch in your private repo, you can
    1. add, delete file that git should track
      • git add . (to tell git to track all newly added files)
      • git add file_name (to tell git to track a specific file)
      • git rm file_name (to tell git to stop tracking a file, does NOT delete the file from the system, but may have to be called after a file has been deleted from the system, so git doesn't continue tracking a non-existant file)
    2. commit your file changes, creating a new local checkpoint
      • git commit (brings you to an editor screen, where you need to type at least a title, and potentially a description separated by a linkbreak)
      • git commit -a (same as above, but equivalent to calling git add . before committing)
    3. undo file changes and return to previous checkpoints
      • git checkout -- file_name (to replace with the copy last saved at a checkpoint)
    4. pushed to the public repo for backup and sharing
      • git push origin branch_name (note that origin is the name of your public repo)
  4. once the branch is stable, merge the branch with the main dev trunk
    1. make sure that your local copy of dev is up to date
      • git checkout origin dev
    2. apply the changes present in dev (i.e. by others) to your own branch
      • git rebase dev (call this while on your own branch)
      • git rebase dev your_branch (or this while on another branch)
    3. move to the dev branch
      • git checkout dev
    4. apply your _stable _changes to the dev branch
      • git merge your_branch (due to the rebase above, you shouldn't run into any merging issues)
    5. sync the newly updated dev with the main repo
      • git push dev

The main repository then, will have two main branches

  • dev where contributors branch new features, and merge stable features
  • master, controlled by Chris, has the main working copy

In addition, many branches off of dev will exist from pushes, which can serve as backup and also used when seeking help.

  • Note that other developers should not branch off these non-=dev= branches
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r3 - 2010-05-04 - jujubix
 
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback