Technical Articles
GIT Basics in SAP WEB IDE — Understanding GIT
Prerequisite: Have a Hana Trial Account.
Scenario : Create a Project and put it in git repository.
- Create your application, if not. For instance, I am creating SAPUI5 Application from “Project From Template”.
- Below is my project structure.
- 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>
- Deploy the project to hana cloud platform.
- Click on Open the application’s page in the SAP HANA Cloud Platform Cockpit.
- A window will open as shown below. Click on Versioning, and you will get GIT Repository URL.
- Go to your project in SAP WEB IDE, and Right click , Select Git, then “Initialize Local Repository”.
- In top right corner you will get option of “Set Remote”.
- Click on Set Remote and paste the GIT Repository URL that we got in step 6. Click on OK.
- Click On GIT PANE in from right tab bar, and now your screen will look like below.
- Click on Fetch.
- Click on Stage All, write Commit Description, and click on Commit.
- 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”.
- Now go to HANA cockpit, click on Refresh, and we will get our latest commit.
- Click on Actions, to create a new version based on latest commit, and give the version number.
- Click on Actions again, and this time to activate the current version.
- After activating, screen will look like below.
- 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.
- 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>
- 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
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
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
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.
Thanks Kiran
“push request failed”
Nice Blog - thanks.
Hi Kiran,
Nice Blog !
Can you please tell me how can two developers access the GIT repository.
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
Hi Kiran,
Nice Blog!
Very helpful and informative....