Monday, 20 March 2017

GitLab Code Chekout,Checkin and Merge Request


 You need to install Git Bash software in you local machine. 

   1. Code Checkout Form Gitlab.

  1. Get open any browser and enter above url.
  2. Get login in gitlab using your LDAP Username and Password or Standard Login.

  3. After login you can see below window.


  4. Before get code in local need to fork your repository, where you want to get code (copy of code for your changes for with out affecting original code ) form master branch. you need to fork project it will create copy of project on your repository.
  5. Click on Fork as shown below.


  6. After fork, you will be enter int your fork project as shown below.




  7. Create location to checkout GC code Ex: C:\WorkSpace\USP_GC\giftcard.
  8. Goto giftcard folder and click right side button of mouse and click select Git Bash.


  9. After select you will get following window.


  10. In git Bash run git init command for initializing git repository (image 1) OR Use git clone <repo url> command Ex: $ git clonegit@gitlab.xxxxxxx.com:USP/giftcard.git ( to download the code from specified repo to local ) image 2.



  11. IF you use clone command then no need to follow step 12 to step 14,if you use init command we need to add remote repository from where we want to get code using : git remote add org (org is alias name) git@gitlab.xxxxxxx.com:USP/giftcard.git  and enter.


  12. Run the command for add repo : git remote add org git@gitlab.xxxxxxx.com:USP/giftcard.git



  13. Do copy your repository link where you want to copy as shown below and again go to the step 9 and add your fork repository link into the git bash (in 2nd image).





  14. After adding remote repo, you can use pull the code form master repo to your fork repo using git pull command  Ex:git pull org master.


  15. You will see code got download in your location folder.


    2. Code Checkin into Gitlab (Pushing changes).

    1. Open Git GUI and click on Open Existing Repository.

    2. Browse your local repository where you have done the changes and click on Open button.


    3. You will get following windows, In this you can see Unstaged changes files, Staged changes (which will be going to commit), commit Message and 4th one for what changes you have done in the file.



    4. Rescan button use for find the changes files form your repo, stage Changed button use for which file you wants to commit into the repo. commit for commit the file into the repo, after commit you can push it to the your gitlab repo.
    5. Once you staged changes file you need to write commit message (Note : Do staged only those file which you have wants to be commit or you have done changes) after that click on commit button.it will ask your username and password, and file changes will committed into the your fork repo.
    6. Once your changes has been committed into the repo you can push that file into the master repo. (Note : you should have the authorization for pushing changes into the master branch otherwise you need create a merge request)

3. How to create a merge request.

  1. Once changes has been committed into your fork branch. you need to create a merge request to a person who is having higher authority to merge the changes with master branch code. 
  2. Merge request can be create form your gitlab, go to your gitlab URL and get log in using your LDAP id and password.as follows.


  3. Click on fork button, It will go to your fork project window.


  4. Click on Marge Requests, you will get below window.


  5. After that click on New Merge Request. and in the Source Branch select source project and source branch(form merge) ,same for Target Branch select target project(To merge).

  6. After that click on Compare branches and continue. and Enter Title and Description and assign to Authorize person who have the right to merge.and submit merge request.


  7. After submit, your request will go to Authorize per and he will merge the changes with Master Branch.

Enjoy Reading.

No comments:

Post a Comment