I accidentally typed git checkout
in GIT CMD without any arguments in my working branch. The parent branch name is development.
After I hit the command it showed the following:
M analytics-engine/build.gradle
M analytics-engine/src/main/groovy/com/oracle/emcsas/securityanalytics/stats/timebucket/ExternalizeTimeBucket.java
M analytics-engine/src/main/groovy/com/oracle/emcsas/securityanalytics/stats/timebucket/TimeBucket.java
But I did not notice any changes in my local branch. All the changes are there. So what did it actually do.
git version 2.15.0.windows.1
Without any arguments, git merge will merge the corresponding remote tracking branch to the local working branch.
The git checkout command lets you navigate between the branches created by git branch . Checking out a branch updates the files in the working directory to match the version stored in that branch, and it tells Git to record all new commits on that branch.
More info: autosetupmerge defaults to true . When set to true, this lets git to perform tracking when you checkout an already existing branch at the remote. For example, if you do git checkout <branch> , git will handle the tracking info so that you can do git pull while on that branch.
Checking out a commit hash will put you into "detached head" state. A commit (hash) can belong to many branches, and many branch HEADs can point to the same commit hash. Checking out a commit (regardless if it is the HEAD of any branch) will put you to the detached HEAD state.
The documentation says
git checkout <branch>
...
You could omit <branch>, in which case the command degenerates to "check out the current branch", which is a glorified no-op with rather expensive side-effects to show only the tracking information, if exists, for the current branch
It shows you the current modified and not commited files in your current branch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With