Hello everybody,
Let's study a bit of how to branch with git.
This is probably one of the best features in git: the ability to create local branches and track them with upstream branch.
For instance, you can have how many branches you want. Let's say you're a maintainer of a driver, so you could use the following branches:
- master (the upstream branch);
- maintenance (used for maintenance tasks);
- experimental (used for experimental work);
Ok. Now that's our scenario. Let's create those branches to see what happens:
$ git-branch maintenance
$ git-branch experimental
Now, if you run git-branch without any parameter, you will see both branches created:
$ git-branch
experimental
maintenance
* master
The "*" in master, tells you that you're now working on that branch, any changes will be committed to it.
If you mis-spelled a branch name you can rename it with git-branch -m oldbranch newbranch. Let's try it out:
$ git-branch -m experimental blabla
$ git-branch
blabla
maintenance
* master
$
It works just fine. Put back the name experimental and let's keep going.
We already how to create and rename a branch... But and if I wanna delete it? It's also really easy:
$ git-branch -d experimental
Deleted branch experimental.
$ git-branch
maintenance
* master
$
Recreate the branch experimental and let's prepare for other post. We're gonna learn how to start editing a branch, committing and merging.
See y'all