How can I switch to another branch in git?

后端 未结 9 671
难免孤独
难免孤独 2021-01-29 17:38

Which one of these lines is correct?

git checkout \'another_branch\'

Or

git checkout origin \'another_branch\'
         


        
9条回答
  •  长情又很酷
    2021-01-29 18:26

    Useful commands to work in daily life:

    git checkout -b "branchname" ->  creates new branch
    git branch                   ->  lists all branches
    git checkout "branchname"    ->  switches to your branch
    git push origin "branchname" ->  Pushes to your branch
    git add */filename           -> Stages *(All files) or by given file name
    git commit -m "commit message" -> Commits staged files
    git push                     -> Pushes to your current branch
    

    If you want to merge to dev from feature branch, First check out dev branch with command "git branch dev/develop" Then enter merge commadn "git merge featurebranchname"

提交回复
热议问题