Saturday, October 31, 2015

GIT Work Flow



















  • Create an account in GitHub. Login to GitHub and create a new repository, say "TestRepo".
  • On your local computer, download Git.exe following the instructions at https://git-scm.com/downloads
  • On your local computer, create a folder, say "TestRepo".
  • Go to command prompt, change directory to TestRepo and C:\TestRepo>git init
  • This above command creates a ".git" folder in TestRepo folder.
  • Now create couple of files, test1.txt, test2.txt, in TestRepo folder.
  • C:\TestRepo>git add . (Note: after git add, a period is there, don't forget that)
  • The above command moves the files test1.txt, test2.txt to staging area.
  • C:\TestRepo>git commit -m "committing test1, test2 files"
  • The above command moves the files test1.txt, test2.txt to local repository.
  • C:\TestRepo>git remote add origin <https clone URL from github>
  • The above command connects to the github when you provide the correct username and password.
  • C:\TestRepo>git push origin master
  • The above command pushes your files from your local repository to github remote repository
  • C:\TestRepo>git pull origin master
  • The above command pulls the files from github remote repository to your local repository.
  • Happy programming!!

No comments:

Post a Comment