git learning (three) - git branch operations

git branch operations

  Start a separate line of development of software project method, can be a good version to avoid compatibility problems developed, to avoid interaction between the different versions of a package development stage to address the bug when a new branch for the bug Research;

 

  git branch associated with the command

  • git branch
git branch branch name to create a branch 
git branch without any parameters, a list of all branches, a branch in front of an asterisk, on behalf of the branch where the current branch 
when * Create branch, branch name without the use of special symbols 

git branch -d branch name   
* you can not delete the branch you're 
deleting a branch, if there are not merge submitted in the branch, the branch will delete fails, then you can use git branch -D xx: xx forced to delete branch, 

git branch -vv 
can view the local branch the corresponding remote branch 

git branch -m old branch name the new branch name

  

  • git checkout  
    • Action File
git checkout filename abandon modify a single file 

git checkout. discard the changes in the current directory
    • Operation branch
git checkout branch name and branch switching 

git checkout -b master switch only if there is a branch branch, if there is to create and switch to the master branch, repo start a package of git checkout -b this command, all the branches are switched warehouse to master, master is the branch name

    

    If the file is modified after a face on a branch, did not commit to switch to another branch b, being given at this time, because there is no commit files are not covered after switching branch, so Git error prompt;

    git checkout -f branches were forced to switch to the branch, if the current promising change submitted directly discarded;
    -f parameter must have to be very, very careful to use, under normal circumstances is not recommended unless really want to force to execute;

 

Guess you like

Origin www.cnblogs.com/coder-zyc/p/11516888.html