skip to Main Content

Working with Git in the Business Application Studio

What is the SAP Business Application Studio (BAS)?

The SAP Business Application Studio (BAS) was launched as a modular development environment in the Cloud Foundry – the SAP Multi-Cloud environment. Its primary focus is to develop business applications. It is presented as an evolution of the SAP WebIDE development platform. 

The BAS specifically benefits in the development of full-stack applications in the cloud environment. In addition, it provides better code editors for JAVA and Node, a desktop-like experience, command-line tools, superior debugging, and many other tools that enhance productivity. 

What are Git and GitHub?

Git is used as a system to help track different versions of a code. Developers use Git all over the world in their projects. Git helps developers collaborative with other developers, keeping track of the changes and the date they occur, and by whom. Git is extremely useful when there is a bug in the latest version of code and reverting the code to the previous version. 

GitHub is a repository where Git projects are hosted. You can sore the Git projects in a remote server anywhere in the cloud. GitHub is just a hosting service.

Why use Git?

  • Git tracks the changes you make to files due to its version control.
  • You can recall your previous version of code in case of any errors in your current committed version.
  • Git allows a team to work together when all the team members are using the same file. It is particularly very helpful during any conflicts when multiple team members are editing the same file.
  • Git is a repository on the internet where you can keep your code and share it with others.

Setting up Git in Business Application Studio

The SAP Business Application Studio comes with a predefined set of Git, so there is no further need to install Git in BAS. In order to set up your Git in Business Application Studio, all you need to do is follow the following steps:

  • Create a GitHub account using the following URL and then Sign in:

https://github.com/

  • Create a new Git Repository by clicking on New

 

  • As the repository name, enter, ‘mybasproject’ and as a description, add ‘My BAS Project’. Now, select “Public” or “Private” and click on the Create repository button.

  • Initially, there will be a README.md file only.

  • Create a simple SAP UI5 application in Business Application Studio and open a new terminal. go inside the project directory using “cd mydemoproject” command:

  • Now using the following Git commands in the terminal, we can commit and push the project to GitHub:

 

    • Enter the command “git init” to initialize an empty Git repository.

Working with Git in the Business Application Studio

    • Enter command “git add .” to add all local files to the local Git repository

Working with Git in the Business Application Studio

    • Enter the following command to commit your local files to the local Git repository. At this point however, the files are not added to your Git repository on the internet because these files are locally committed.

git commit -m “first commit

Working with Git in the Business Application Studio

    • Now to create a remote setup, copy the below URL from GitHub:

 

https://github.com/………./mybasproject.git

    • Now enter the following command:

 

“git remote add origin https://github.com/……../mybasproject.git

Working with Git in the Business Application Studio

    • Enter the “git push” command to move all the locally committed files to the GitHub repository.

Working with Git in the Business Application Studio

    • Now after you have refreshed your GitHub account, you will find the locally committed files reflected in your Git repository as shown below:

Working with Git in the Business Application Studio

    • You can also pull any changes pushed by other developers to the same repository using the following command:

git pull origin master

    • You can clone an existing repository using the following command:

git clone https://github.com/………../mybasproject.git

Working with Git in the Business Application Studio

Using the SAP BAS, you can connect to the Corporate Git Repository. You can also connect to all public git services, such as GitHub, GitLab, and GitBucket.

 

To view similar content, visit our resources page, here.

Amrit is an SAP UI5 Fiori senior consultant, working as a Technical Lead at Mindset. He is an SAP UI5, Fiori, Javascript, HTML, CSS, JQuery, and SAP BTP guru. When not working, you will find him playing chess, traveling, and spending time with his family. Amrit enjoys hiking and exploring new places.

Back To Top