Changes between Version 70 and Version 71 of DeveloperGuidelines/Git


Ignore:
Timestamp:
09/18/13 11:17:12 (8 years ago)
Author:
Pat Tressel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/Git

    v70 v71  
    190190and this is a fast operation in git.
    191191
     192To make a new branch equivalent to the current branch:
     193{{{
     194git checkout -b <new_branch_name>
     195}}}
     196
     197To switch from one branch to another, just check out the other branch:
     198(((
     199git checkout <other_branch>
     200}}}
     201
     202Note git will not let you switch to a different branch if you have uncommitted changes in tracked files.
     203To get around this, the simplest thing to do is to commit your modified files in a temporary commit,
     204then undo that commit later. You can also "stash" your work, which actually makes a commit on a special
     205branch. Since it's easy to forget what's in the stash, unless you're only stashing briefly, a real commit
     206with an informative message is probably better.
     207
     208To list all the branches in the repository:
     209{{{
     210git branch -v
     211}}}
     212The -v (for verbose) tells git to show not just the branch names, but also the head commit's revision number and message.
     213
     214To rename the current branch:
     215{{{
     216git branch -m <new_branch_name>
     217}}}
     218
     219To rename a branch that is not checked out:
     220{{{
     221git branch -m <old_branch_name> <new_branch_name>
     222}}}
     223
     224To delete a branch:
     225{{{
     226git branch -d <branch_to_delete>
     227}}}
     228
     229Under some circumstances, git will complain when you try to rename or delete a branch. If you are sure
     230you want to do it, use -M instead of -m for rename, or -D instead of -d for delete.
    192231=== Creating a second working directory and repository ===
    193232If you wish to have multiple directories containing different branches, you can run these as separate web2py applications.