Setting up git
If you've never used git before; it's probably best to start with github, it's a free service so long as you are doing an open source project. If you have the ability to run your own server and require keeping your project closed source and not in the hands of a third party, then it's perfectly reasonable to run a local git server.
As the process for setting up github is very simple, it seems reasonable to do a quick blog post about how to use git in a day to day type of setting. First let's cover a few things about the theory of git.
Git is a versioning control system. It works by allowing remote computers to work on the current version of everything in a project. Git keeps the entire history and change logs inside a subfolder of the project hidden from normal view called ".git". Git works by comparing the contents of the directory on the remote server with the directory locally to see what has changed and what needs to be added. This local git folder means that git will track your changes in your local repository leaving the one on the remote server alone. When ready to sync between the local and the remote server, you would push to remote and pull from remote.
To get a repository, simply clone it once to create a local git project. Then work on the project to make changes and finally use git add to add new files or git status to tell you what needs to be committed and finally push your changes back onto the server. That is to say, you work on the files as normal, run your tests and validate that everything works, then you'd commit your changes to your local git folder by running git commit, and finally when everything is working, push your changes back to the remote server.
As the process for setting up github is very simple, it seems reasonable to do a quick blog post about how to use git in a day to day type of setting. First let's cover a few things about the theory of git.
Git is a versioning control system. It works by allowing remote computers to work on the current version of everything in a project. Git keeps the entire history and change logs inside a subfolder of the project hidden from normal view called ".git". Git works by comparing the contents of the directory on the remote server with the directory locally to see what has changed and what needs to be added. This local git folder means that git will track your changes in your local repository leaving the one on the remote server alone. When ready to sync between the local and the remote server, you would push to remote and pull from remote.
To get a repository, simply clone it once to create a local git project. Then work on the project to make changes and finally use git add to add new files or git status to tell you what needs to be committed and finally push your changes back onto the server. That is to say, you work on the files as normal, run your tests and validate that everything works, then you'd commit your changes to your local git folder by running git commit, and finally when everything is working, push your changes back to the remote server.
Comments
Post a Comment