Even when working alone or on simple projects, I like to have the benefits of source control – history, branching, and backup.
Usually I keep the repo on one drive (that is backed-up) and the project itself on another.
Git is the solution I decided upon at this point because it has become a open source industry standard. Here are the common steps that need to be taken to use git in this scenario.
Create a folder that will serve as the repository, let’s call it repo. (In my mind, this is the “server”, the destination where the files and changes are tracked, and where you can get the files in various states from.)
Enter this folder and connect it to git:
Then you need to add a file to the repo.
touch readme.md git add readme.md git commit -m "init"
After this, the “master” branch exists and is checked-out in the repo. Now you need to unlock the master branch.
git branch live git checkout live
(These two steps are missing in a lot of online guides for some reason. It’s a specific thing for git, and kind of strange. Only now, you will be able to start pushing to the master branch. The live branch you can merge from time to time, whenever you have a release ready for example.)
The repository is ready.
Now clone the repository into a (non-existing) working folder:
git clone &lt;path_to_repo&gt; &lt;working_folder&gt;
Go into the newly created working folder and switch it to the master branch (it’s currently on the live one):
git checkout master
Now you are ready to start using git operations – commit, push and the rest of the operations will be reflected to the repo folder when you merge.
git merge master
git add [-n] .
git commit -m "Commit message"
git push origin master
git reset &lt;file&gt;
git reset HEAD~1
Revert all changes
git reset --hard HEAD~1
(More info on Stack Overflow)
The repo folder needs to be copied entirely. Then, change the working folder to the new one:
git remote rm origin git remote add origin &lt;path_to_new_remote&gt;
git branch -vv
git config --global url."https://".insteadOf git://