GITHUB

Hi all, from this post I’m going to introduce you a distributed revision control and source code management system. Version Control System (VCS) is a software that helps software developers to work together and maintain a complete history of their work. From here on let’s talk about Git.

  • You can install Git using the following command in LINUX.

sudo apt-get install git

  • After that we can customize the Git environment by adding some information to it.
    • Set user name :
      • git config --global user.name "vimukthis"
    • Set email :
      • git config --global user.email "jerry@tutorialspoint.com"
    • Avoid merge commits for pulling :
      • git config --global branch.autosetuprebase always
    • Set color highlighting :
      • git config --global color.ui true
      • git config --global color.status auto
      • git config --global color.branch auto
  • Then we can list our customization using the following command.

git config –list

100.png

  • After setting these customizations we have create a SSH public/private key pair.
  • You can do it by using following command.

ssh-keygen

  • After you share your public key with the server, now you are ready to connect to a repository. But don’t share your private key with anyone.

Now all the setup are done and now you are ready to work with Git. Let’s see some of the basic commands in Git.

  • I want to get a project from a repository. ‘git clone‘ is used to that.

1.png

  • From here on now you can work as usual, because now the project is on your local computer. Let’s view the files in the project.

3.png

  • I’m going to create some directories and files inside the testing directory.

5

6

  • Next we need to add the directory and files what we created to the staging area. We can do this using the ‘git add‘ command.

11

  • After adding it to the staging area then we can commit it. Here the parameter ‘-m‘ will add a message to the commit as well.

15.png

  • Then we can ‘push‘ all the changes to the server.

16.png

  • Also using the ‘pull‘ command we can get updates from the server.

12.png

  • There is a log file where you can see all the commits done by different users. You can view the log file by ‘git log‘ command.

9.png

  • Then we can get more information about a commit using the commit ID taken from the log and use it with the ‘git show‘ command.

17.png

18.png

  • Also if you want we can add tag with different information as well. Here the ‘-a‘ gives a name to the tag and the ‘-m‘ gives the message.

20.png

  • Using the ‘-l‘ with the previous command we can view all the created tags. Here I have used it with ‘grep’.

21

  • If you want to delete a tag, it is also possible with the ‘-d‘ parameter.

22.png

Here I have talked about some of the basic commands used in Git and installation of Git in a LINUX computer. Hope you are clear with Git. Hope to see you soon with another interesting blog post. Thank You!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s