Friday, 27 October 2017

Git Commands

1. clone repository from master branch to local

   Ex) git clone http://domain/repository.git

2. create/checkout branch in local to start before working

Ex) git checkout -b yourbranchname

3. commit your local changes

Ex) git add -A (add any new files)
       git commit -a -m "your comments"

4. In step 3 we have commeted changes these are save in local temp noew we have to push these changes to branch

Ex) git push origin yourbranchname 
     
5. In step your changes are in your branch next step based on company they will setup example some companies they will raise an PR some one will review and then have to approve then your changes will merge to actual master branch


some time insted of create branch we are working master branch. so you done some changes in master branch now you created new branch. If you check out to new branch these changes will lost.
that case we have to stash changes, checkout new branch later apply stach

Ex) git stash
       git checkout -b yourbranch
      git stash pop


No comments:

Post a Comment