• Distributed version Control system(VCS) or Source control management(SCM)
  • Allows collaboration of work between multiple developers
  • Keeps signature of who did what and when
  • Deals with local as well as remote repo
git init //initialize local git repo - will create .git folder


with no other info given output of the
git status and git show




adding two files to local repo(used touch cmd and vi editor to edit the file)
git status


add file(s) to index/staging area before commit
git add <file>


to unstage the file
git rm --cached <file>


to add all files
git add .


commit changes in index
git commit -m 'comment/message'


create branch
git branch <branch name>
git branch branch1


to change to the branch from master
git checkout <branch name>
git checkout branch1




git branch                 // list branches
git branch -a                   //list all branches
git branch -d <branch name> //delete branch


to merge the branch changes to master(checkedout in master)
git merge -m "message" <branch name>


git show  //shows author, email id and where the head is point(master or branch)
git show-branch


Remote repo

git push //push to remote repo


At the time of copying the github repo URL for cloning, showed following error
NPriya@ODSWER42SH MINGW64 ~/Desktop/rp/webzash/yaap
$ git clone –https://github.com/librelab/yaap.git
Cloning into 'yaap'...
fatal: protocol '–https' is not supported

it was because of pasting it using cntrl + v on the mingw64 terminal which inserts a hidden ^?

use the right click - paste         //to paste the correct URL





git pull //pull latest from remote repo
git clone //clone repo in a new dir



Git configuration

git config --global user.name "<username of your github account>"
git config --global user.name "librelab"
git congig --global user.email yourmail@gmail.com


0 comments:

Post a Comment

top