I am currently taking the course GIT and GITHUB from udacity. One thing I'm really confused is what is the difference between remote and branch as both makes the same sense to me, as per my understanding.
To be precise here, let's use Git's own documentation on What a Branch Is:
A branch in Git is simply a lightweight movable pointer to one of these commits.
A branch in Git is just a pointer to a commit. Typically, this commit will in turn be connected with other commits in a chain or branching chain structure. When we usually think of branches, we think of collections of commits logically ordered in some way, but technically speaking a branch is just a pointer to a commit.
Again, from the documentation on Working with Remotes:
Remote repositories are versions of your project that are hosted on the Internet or network somewhere
The remote, which is really just short for remote repository, is a central place where branches and their commits are stored. The remote can also have branches, but typically you don't interact directly with these remote branches. Instead, there are local remote tracking branches, which, as their name implies, track the true state of the branches on the actual remote.
They are totally different concepts.
A remote is basically a location where a copy of the repository is stored. So for example you could have one remote in GitHub, another in BitBucket, another in Kelly's PC, etc.
A branch in your repository means that you have temporarily made some changes that you don't want to put into the main branch just yet because you aren't done with it (or for other reasons). They can be local, so that your remotes never see them, or you can push the branch to the remotes.
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