One reason to get on board is that you can more easily contribute to other projects if needed. It’s not too uncommon to hit some kind of road block when using a 3rd party script/lib. Being able to submit code to the project yourself (or at least forking it) is quite helpful. It of course also helps if you’re ever in the situation where you’re going to work on a project with a new/existing team. Without any numbers to refer to I feel it’s a high chance other projects/teams are using git already.
Git isn’t that bad to get started with, yes it has some strange sides to it - but your normal day to day usage will not be very complex at all.
I use git in command line, but there are also quite a few GUI applications available. If you want to use command line in Windows I suggest using something like CMDer (free). If you want to give it a go get the full package, you will then have ssh/git/etc available.
Cmder is a software package created out of pure frustration over the absence of nice console emulators on Windows.
http://cmder.net/
Get started
[size=8pt](if you’re not using CMDer or similar solutions you’d need to start with installing git)[/size]
$ git config --global user.email "[email protected]"
$ git config --global user.name "your name"
Initialize a repository
$ git init
Add all files
$ git add .
Commit all files
$ git commit -a -m "some commit message"
View commits
$ git log --oneline
Revert (undo) commit
$ git revert <commit id>
That is basically what you need, as a one man band.
[hr]
Branching
For bigger projects I suggest you use branching, even as a single developer.
Imho branching gives you both a more visual feature history, and an easier way to include/exclude features in your project.
Ie you’ve made a calendar widget and a event list. You then realize you have to change one of them, or one isn’t working according to specs. If these features are in a mish mash of commits on the master (default) branch, then picking it out will be a nightmare. If you’ve made separate development branches for the features you can simply not merge it into the master branch, or if it’s already merged you can revert it in a single command.
Below is an example of how feature branches could be used to “containerize” development.
[ul][li]Every commit on the master branch is a release[/li]
[li]Features are made in their own branches and merged back into develop when done[/li]
[li]X number of features are then merged from develop into master to form a release[/li][/ul]

List branches
$ git branch -a
Create branch
$ git checkout -b branch-name
Merge branch feature-one into develop branch
$ git checkout develop (if you're not already on develop)
$ git merge feature-one
Delete branch
$ git branch -d feature-one
[hr]
Hosted repo
I do strongly suggest you use a hosted service though, it makes collaboration easier, and you can rest assured your data is also “in the cloud” (had to get a buzz word in here). Gitlab has free private repositories, and you can even host it yourself - if you want. These services also have other features, like issue tracking, wikis, web ui for branching/pull requests/general git usage, etc.
To work with remote sources you need a ssh key to verify your identity. It’s recommended to protect the key with a password.
$ ssh-keygen -t rsa -b 4096 -C "[email protected]"
This creates two files
%UserProfile%.ssh\id_rsa is your private key which is not to be shared
%UserProfile%.ssh\id_rsa.pub is your public key which you need to add to services you want to use
Ie in Gitlab/Github/Bitbucket you have a “SSH keys” setting in your user control panel, where you must add the public key(s) you wish to use with the service.
After creating a project in the hosted service you can simply
If it’s a new project (you don’t have a local repository)
git clone https://gitlab.com/your-user/project-name.git
cd new-project
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
If it’s a project you have started on locally (have a local repository)
git remote add origin https://gitlab.com/your-user/project-name.git
git add .
git commit
git push -u origin master
Your local repository is now linked to the hosted repository. And you can
[ul][li]push commited changes from your local machine to the hosted service[/li]
[li]pull changes from the hosted service to your local machine[/li][/ul]
[hr]
Learn more
For more info I highly recommend Atlassians wiki, it has great information with visuals on how to work with git. Note that this goes to great depths though, so you might have to consider how “deep” you want to go.
It can also be helpful to play around with it visually, of which this is a great tool:
https://onlywei.github.io/explain-git-with-d3/
[hr]
Other
Other than git I highly recommend you look into using an IDE to make life as a dev easier.
A proper IDE will give you syntax highlighting, code completion and much more. I’ve written a post about it here: http://www.phphelp.com/forum/the-occasional-tutorial/make-your-life-simpler-use-an-ide!/
I can recommend PHPStorm (paid) and Netbeans (free)
![how-to-use-git-branch-15-638[1].jpg](https://www.phphelp.com/uploads/default/original/2X/6/6d05412a0d535ce1600ef9e12a9a5034baf90fcb.jpg)