Is flexbility really necessary?


An annoying feature in Git Scm is the ability to execute a task in multiple ways. For example, you can create a new branch using either of the two commands:

i. git branch <new-branch-name>
ii. git checkout -b <new-branch-name>

The second option gets executed more frequently as it involves creating a new branch and checking it out as well. The first option only creates a new branch.

Another similar example is the git pull command. The git pull command is equal to a git fetch + git merge. While this provides more flexibility, it often means that git pull gets executed more frequently than fetch + merge. 


It would be interesting to see examples of cases where one only needs to fetch changes, but not merge them or when one just needs to create a branch without checking it out.

Comments

Popular Posts