What is Git and why do I need it?
In short, the Fiori User Interface (UI5) code does not have the equivalent of version management like ABAP does. Sure, when you deploy your UI5 code to your Gateway/Fiori server, a copy of the executable files are stored; but the whole workspace is not.
That’s where Git repositories come in. In fact, most of the software industry seems to use Git repositories now days; so it’s not too scary; and unlike ABAP; it supports multiple versions, concurrent development, merging; and a whole bunch of other cool stuff.
So anyway, why do you need it? Well you just do okay – trust me 😉
Git Repositories and HCP
Now that we have a way of getting into HCP without pulling out the corporate credit card; we can start to leverage WebIDE and the features of HCP. One of these features is the Git repositories.
Previously I had been using github.com which works perfectly (if you have access to it); and having your own on-premise git repository would work fine also. But until today, I had not tried to use the HCP Git, but it’s surprisingly easy.
Creating an Extension project with an HCP Git Repository
So within the HCP Cockpit, you’ll need someone with administrator access to create an appropriate named git repository for your extension.
Navigate to Git Repositories and select New Repository:
Name the repository and keep the “create empty commit” checked and press OK!
Go into the repository and then select Web IDE to open Web IDE and automatically kick off the clone repository process (which simply creates a project folder linked to this Git Repository). Note – You’ll need to enter your S-User (or similar) Id and Password.
Commit and Push when you receive this pop-up.
Note – If you do the above too quickly, you can sometimes hit an issue that the repository is not fully set-up (I think!).
Let’s now create the extension project into this Project Folder:
Select File->New->Extension Project
Now select the Fiori app to extend, and very carefully type in your new project folder as the name of the extension project:
Press Next, uncheck the extension pane checkbox and Finish.
If you select the Git pane on the right hand side; you can select Stage all check box; enter a comment and press Commit and Push (to origin/master).
Other users can then access the git repository through the Web IDE link from the cockpit; and you can start branching off, merging, pulling, fetching, rebasing and all the other cool terms that I always defer to Nigel James to explain to me…
Bonus Item #1 – Github Desktop with HCP Git Repository
Oddly enough, if you use Github desktop (I do because I find the diff tool when set-up correctly very powerful for merging branches) doesn’t support cloning the repository directly. That said, all you need to do is go to the command line, type git clone <repository link from the HCP Cockpit>, entering your username/password to get a local copy of the repository; then from within Github desktop, you can add the repository using the add local repository option (then it’s just the same as if you cloned it from Github.com at that point.
Bonus Item #2 – Getting mockdata working with My Inbox
For a few reasons, it’s not immediately obvious how to get the mock data provided by My Inbox to work. But if you want to get it working (which is very handy); do the following:
• Create a folder under localService called mockdata
• Cut and Paste all the JSON files under localService into mockdata
• Under project settings, change the mock data to match the following screenshot:
• Create a run configuration with “Run with mock data” set, ensuring that allItems = true within the URL Components
• Save and Run!
Result with mock data (unfortunately without the Fiori Launchpad which has the subscription functionality: