Skip to Content
Technical Articles
Author's profile photo Kiran Israni

GIT Basics in SAP WEB IDE — Understanding GIT

Prerequisite: Have a Hana Trial Account.

Scenario : Create a Project and put it in git repository.

  1. Create your application, if not. For instance, I am creating SAPUI5 Application from “Project From Template”.
  2. Below is my project structure.


  3. Let’s say, I have following code in view.
    <mvc:View xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
    	controllerName="com.git.basicGitBasic.controller.GitView" displayBlock="true">
    	<App>
    		<pages>
    			<Page title="{i18n>title}">
    				<Label text="Welcome to Git" width="100%" id="idWelcome" design="Bold"/>
    			</Page>
    		</pages>
    	</App>
    </mvc:View>
  4. Deploy the project to hana cloud platform.


  5. Click on Open the application’s page in the SAP HANA Cloud Platform Cockpit.

  6. A window will open as shown below. Click on Versioning, and you will get GIT Repository URL.



  7. Go to your project in SAP WEB IDE, and Right click , Select Git, then “Initialize Local Repository”.


  8. In top right corner you will get option of “Set Remote”.


  9. Click on Set Remote and paste the GIT Repository URL that we got in step 6. Click on OK.


  10. Click On GIT PANE in from right tab bar, and now your screen will look like below.


  11. Click on Fetch.


  12. Click on Stage All, write Commit Description, and click on Commit.


  13. Now click on Rebase , select the remote branche origin/master, and click on OK button. Now click on Push Button, and select origin/master.  After 5seconds, in the top right corner, you will get “Push has been completed”.
    Recently, I got few comments: Rebase is throwing error at this point in latest versions. Hence, modifying this point:
    Click on Commit and Push Button, and select origin/master.  After 5seconds, in the top right corner, you will get “Push has been completed”. 



  14. Now go to HANA cockpit, click on Refresh, and we will get our latest commit.


  15. Click on Actions, to create a new version based on latest commit, and give the version number.


  16. Click on Actions again, and this time to activate the current version.

  17. After activating, screen will look like below.


  18. For another developer, to get the application in the workspace, click on File, Git, then Clone Repository. Since I am the same developer, and I already have application in my workspace, I won’t perform Step 18.
  19. Important : Before starting to make any changes, make sure, first FETCH the code, then Rebase (to get back any new commits from remote branch, so that we are in sync), make changes in the code, STAGE ALL your changes, write Commit Description, then commit, then push.

    <mvc:View xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
    	controllerName="com.git.basicGitBasic.controller.GitView" displayBlock="true">
    	<App>
    		<pages>
    			<Page title="{i18n>title}">
    				<Label text="Git modifications" width="100%" id="idWelcome" design="Bold"/>
    				<Button text="Modified"/>
    			</Page>
    		</pages>
    	</App>
    </mvc:View>


  20. Go to Hana Cockpit, Refresh, provide the new version and activate the application.



 

That’s all for now.

Please feel free to provide your queries/doubts/suggestions/corrections.

 

Thanks

Kiran Israni

Assigned Tags

      9 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Denys van Kempen
      Denys van Kempen

      Great blog, Kiran.

      For those interested, there is also a playlist on the SAP HANA Academy about this topic:

      https://www.youtube.com/playlist?list=PLkzo92owKnVwnV5o1psI7XSA-AquO9_9g

      Author's profile photo Former Member
      Former Member

      Hi Kiran Israni,

       

      I was not able to 'Set Remote' for the first time when I get the git url.

      How can I get the same window again? I  tried my luck but wasnt able to ( beginner ) .

       

      Cheers

      D

      Author's profile photo Kiran Israni
      Kiran Israni
      Blog Post Author

      Hi

       

      See the main concern should be to get "Configure GIT repository" dialog box. For me, since the option is coming automatically, i am not able to reproduce the issue.

      But still, there is another way to find the option.

      Right Click on project, select Git, then "Initialize local repository".

      Then again right click on project, get, then "Set Remote". See the snapshot below.

       

      Hope this helps.

      Please revert, if any issue.

       

      Thanks

      Kiran Israni.

       

      Author's profile photo Former Member
      Former Member

       

      Thanks Kiran

      Author's profile photo charan teja
      charan teja

      But i was trying to  set remote I’m getting error like

      “push request failed”

      Author's profile photo Rama Shankar
      Rama Shankar

      Nice Blog - thanks.

      Author's profile photo Arpita Nath
      Arpita Nath

      Hi Kiran,

      Nice Blog !

      Can you please tell me how can two developers access the GIT repository.

      Author's profile photo Venkat V
      Venkat V

      Hi Kiran,

      Can you please explain me technical terms like Stage All,Pull,Fetch,Push,Rebase,Commit. Explaining with an example is not enough.

      Also how does it make difference from  Retreive from ABAP repsository just like we do in Eclipse IDE?

       

      Regards,

      Venkat

       

       

       

      Author's profile photo Inderpreet Singh
      Inderpreet Singh

      Hi Kiran,

      Nice Blog!

      Very helpful and informative....