Changes between Version 70 and Version 71 of DeveloperGuidelines/Git

09/18/13 11:17:12 (8 years ago)
Pat Tressel



  • DeveloperGuidelines/Git

    v70 v71  
    190190and this is a fast operation in git.
     192To make a new branch equivalent to the current branch:
     194git checkout -b <new_branch_name>
     197To switch from one branch to another, just check out the other branch:
     199git checkout <other_branch>
     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.
     208To list all the branches in the repository:
     210git branch -v
     212The -v (for verbose) tells git to show not just the branch names, but also the head commit's revision number and message.
     214To rename the current branch:
     216git branch -m <new_branch_name>
     219To rename a branch that is not checked out:
     221git branch -m <old_branch_name> <new_branch_name>
     224To delete a branch:
     226git branch -d <branch_to_delete>
     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.