Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.
When you commit a file to Git, you are committing it to the current branch.
Git allows you to work simultaneously on multiple, separate branches—different lines of development that represent forks of the main branch.
Git is very flexible: you can have a virtually unlimited number of branches active at the same time, and they can be developed independently until you want to merge one of them into another.
By default, Git creates a branch called main. It’s not special in any way other than it’s the one created initially.
You can create a new branch called develop by typing:
git checkout -b develop
The git branch command lists the branches that the repository has.
When creating the new branch, that branch points to the latest commit made on the current branch. If you switch to it (using git checkout develop) and run git log, you’ll see the same log as the branch that you were previously.