in Technology by

What is the difference between git checkout [branch name] and git checkout -b [branch name]?

1 Answer

0 votes
by

The command git checkout [branch name] will switch from one branch to another.

The command git checkout -b [branch name] will create a new branch and also switch to it.

Related questions

0 votes
    What is the Git command to move branch pointer to different commit without checkout? A. Git cherrypick B. Git update-ref C. Git reset head...
asked Dec 24, 2022 in Technology by JackTerrance
0 votes
    What does the command git checkout -b branchname do? A. Creates a new branch and switches to this new branch B. ... branch C. Deletes the new branch D. Commits the new branch...
asked Dec 20, 2022 in Education by JackTerrance
0 votes
    How to get the current branch name in Git?...
asked Jan 8, 2021 in Technology by JackTerrance
0 votes
    What does the command git checkout branchname do? A. Adds the new branch B. Switches from main branch to the new branch C. Commits the new branch D. Deletes the new branch...
asked Dec 21, 2022 in Technology by JackTerrance
0 votes
    I'm trying to configure my Jenkinsfile to run in one which already have access to my git repository via ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 8, 2022 in Education by JackTerrance
0 votes
    How to rename and remove branch in remote Git?...
asked Aug 24, 2021 in Technology by JackTerrance
0 votes
    How to push a new local branch to a remote Git repository and track it too?...
asked Jan 7, 2021 in Technology by JackTerrance
0 votes
    When you run git fetch from my local repo, will it update your local code and target branch? (1)Yes, the command ... new commits and keep them in a separate branch in local repo...
asked Oct 26, 2020 in Technology by JackTerrance
0 votes
    What is the Git command to create a branch? A. git invoke branch branchname B. git add branch branchname C. git create branch branchname D. git branch branchname...
asked Dec 20, 2022 in Technology by JackTerrance
0 votes
    How can we create a remote Git branch?...
asked Jan 8, 2021 in Technology by JackTerrance
0 votes
    Move the most recent commit(s) to a new branch with Git?...
asked Jan 7, 2021 in Technology by JackTerrance
0 votes
    How can we check out a remote Git branch?...
asked Jan 7, 2021 in Technology by JackTerrance
0 votes
    How can we rename a local Git branch?...
asked Jan 7, 2021 in Technology by JackTerrance
0 votes
    How git replace with origin branch?...
asked Dec 10, 2020 in Technology by JackTerrance
0 votes
    Can you recover a deleted branch in Git?...
asked Nov 4, 2020 in Technology by JackTerrance
...