git

Since i have been working in many projects, remembering the code, i have changed overtime  is almost impossible for me. Since, i have to move to different locations, i cannot  reach the server all the time, so i have to work offline. And, later when i get online, i have to update the changes back to the main repository server.  The solution for this, i have found  was Git application, which is distributed version control system.

 

Git Installation

 

 

Basic Configuration

 

 

Creating Local Git Repository

 

After this, i added files to the project and committed the changes as,

Other things, i did was listing files, check status, remove files, check log as,

I created a branch and switched to that branch as,

Then, after certain changes in my branch1, i merged the changes back to the master branch as,

I can also merge the changes in another way as,

Sometimes, i had to undo last committed merge and i did as,

After merging, i could delete the branch as,

I hardly used stash until now. But, it can be done as,

 

Creating Remote Repository

 

Then, i generate ssh-key in my local computer as,

In remote server, i created a user called git  and switched to git user as,

From here, everything was done as git user in server repository. And, for publishing my project,  i created post-receive files inside hooks directory as,

I made the post-receive executable as,

To, give access to client computer to my server repository, i need to add authorized keys in server as,

 

Pushing from Local to Remote Repository

 

 

Cloning from Remote repository to Local repository

 

 

That’s it.

References:

1. https://www.atlassian.com/git/tutorials/ 

2. http://git-scm.com/docs/gittutorial

3. Git Cheat Sheet 

4. Visual Git Cheat Sheet

5. http://stackoverflow.com/questions/2745076/what-are-the-differences-between-git-commit-and-git-push

Cheers!