In: Computer Science
In git, the term "branch" and the term "commit" mean exactly the same thing (i.e. all branches are commits, and all commits are branches)?
Ans . No, a Branch in a git is simply a moveable pointer to the commits. By default the branch name in git is master.when you start making commits you are given a master branch that points to the last commit you made every time when you commit the master branch pointer move forward
If i explain you in simple words Commit is like a diary entry and Branch is just like having a second dairy
A commit marks a point in a time , state and in a record.You can make lots of commits over the life of the project.
We can say a branch is like a duplicate dairy where you can write your first draft before merging them all into your Master or Main dairy
We can also say commiting means to create a revision , normally on a branch(it's not compulsory in git) and in Git Branches are just pointer to revision.
A typical book answer will be
A branch can be also thought of as a pointer to Commit.we can also use term Branch to refer the set of commits comprised by the commite being pointed to and all of its ancestors.
The commit as re arranged in a tree manner where each commit(except first on) have one or more ancestor commits
Branching is just simply adding a new pointer which is pointing to some of commits.it does not change the tree of commits in any ways