Friday, July 21, 2017

Working with GIT : Basic Commands

What is GIT :
  1. Git is a version control system (VCS) for tracking changes in computer files and coordinating work on those files among multiple people. 
  2. It is primarily used for source code management in software development, but it can be used to keep track of changes in any set of files 
  3. Git was created by Linus Torvalds in 2005 for development of the Linux kernel, with other kernel developers contributing to its initial development. Its current maintainer since 2005 is Junio Hamano. 
  4. As with most other distributed version control systems, and unlike most client–server systems, every Git directory on every computer is a full-fledged repository with complete history and full version tracking abilities, independent of network access or a central server. 
  5. Like the Linux kernel, Git is free software distributed under the terms of the GNU General Public License version 2. 



Basic Commands :

  1. git clone <repo path> Clone a repository into a new directory 
  2. git status  - Show the working tree status like file a is modified and file b is newly added. 
  3. git add <file name> - Add file contents to the index 
  4. git commit -m “message1” - Record changes to the repository 
  5. git pull – Fetch from and integrate with another repository or a local branch (fetch + merge)   Git pull is useful when you are working on your local branch and you want to merge your changes with the latest central repo.                                                                                       Note1: Before using git pull, always commit your changes 1st so that it may merge with central repo.                                                                                                                                       Note2: Before using git commit we need to use git add. 
  6. git checkout <file A> – it will revert your all changes of file A in local branch 
  7. git blame <file A> - it will show all the modification done to file A with the person name , time and line no. It helps to migrate changes done by a particular person in file A, to another file or project. 



No comments:

Post a Comment

Ethernet and more

Ethernet is a protocol under IEEE 802.33 standard User Datagram Protocol (UDP) UDP is a connectionless transport protocol. I...