Branches are like "Save as..." on a directory. Best of all:
- Easily merge changes with the original (changes tracked and never applied twice)
- No wasted space (common files only stored once)
Why branch? Consider the utility of "Save as..." for regular files: you tinker with multiple possibilities while keeping the original safe. Git enables this for directories, with the power to merge. (In practice, svn is like a single shared drive, where you can only revert to one backup).
To add new branch master
git checkout -b master
This will create a new branch and switch to it.
Add all files:
git add .
Commit added files to master:
git commit -m "first commit"
Posted by kiatng to Git (2014-05-08 13:52)