HostOnNet Blog

Git for Beginners

Looking for Linux Server Admin or WordPress Expert? We can help.

Git-Logo

GIT is a version controlled system which you can use to maintain code for your project. It helps you to save your project at different versions, so that you can retrieve a previous version of your project without any problem. Source codes(or files) are saved in repositories. You check out the files from a version, make some changes, save it and commit changes to create a newer version of your project.

Git allows a team of people to work together, all using the same files.
And it helps the team cope with the confusion that tends to happen when multiple people are editing the same files.

When a new developer starts, he downloads all the files from Github, which is an online server we’re all connected to.

Now the developer has his local version of the files.

When you make changes in files or before start the the modification,right click on the project folder, click Git Bash and enter

git pull origin master

This command pulls the latest changes down from github. If there are contradictions between those and my local ones, it tells me what they are, file-by-file, line-by-line, and I now have a chance to reconcile those differences.

Before we work on a new feature, create a branch in git.

So, take “Git Bash”, now run

git branch BRANCHNAME

That created a branch with name “BRANCHNAME”. Now lets switch to that branch.

git checkout BRANCHNAME

Now you can work on this branch, Once feature is ready, commit changes through “GIT GUI”, this is the only stage we use GUI, everything else done through command line (git bash).

Now push the changes to server.

git push origin BRANCHNAME

About Sibi Antony

Bootstrap and Android LOVER. I've been creating things for the web for over 10 years, from the period of flash and table based layout web sites till mobile and tab friendly web sites.
Posted in Linux

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.