Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sharathmg
Active Contributor
Hello All,

In this blog, we will go through the steps to be followed to integrate the git fileshare, push the code, commit the code and pull the code.

Brief Introduction to Git: 

Git is a distributed version control system. The code and its changes are stored as snapshots instead of delta changes.

When you make a commit, Git stores a commit object that contains a pointer to the snapshot of the content you staged. When you create the commit by running git commit, Git checksums each sub-directory (in this case, just the root project directory) and stores those tree objects in the Git repository.

A repository is a central location in which data is stored and managed

A branch in Git is simply a lightweight movable pointer to one of these commits. The default branch name in Git is master. Every time you commit, it moves forward automatically.

Import/Initialize a Git project repository into Web IDE:

Step 1: Create a repository in the SAP Cloud Platform Cockpit.



Step 2: Now, the newly created Git Repository is displayed in the list of repositories. When we click on the repository, it will display the remote link to the repository.



Step 3: You can initialize the newly created repository to the existing project using the option Git -> Choose the option “Initialize the Repository”. This will create a local repository i.e. repository in your local system.

Step 3.1: Set the repository to remote by providing the URL of the remote server i.e a central server in which the GitHub is made available to the project team. This will ensure that the project files are uploaded and synced in the remote server.

Step 4: Cloning a Repository: In this activity, we take a copy of the project in the central folder. In Web IDE, you can clone a repository by right-click on the Project -> Git -> Clone Repository.

 



Step 4.1: Provide the URL to the Git Repository



Step 5: Once the clone is complete, select the project and click on the Git Pane on the right side of the Web IDE. It will display the following details related to the project in Git:

  1. Branch which is cloned and linked to the project. Default branch is "Master".

  2. List of operations available for the project in the Git Repository Ex: Push, Pull, Fetch, Show Stash etc.

  3. Commit Table where the files which are edited, staged are listed. You can revert the changes by clicking on the option to Discard Changes in the table.




Once you start editing the files and save them, that particular file will get listed in the Commit table. You can select to stage the file i.e. include the file in the commit activity. Only staged files are committed into the repository.

Step 6: Commit the code by clicking on the commit button below the table. To commit the code, a Commit Description is mandatory.

          

 

Step 7: Once code is committed, any other member in the team can import the code using the Clone Repository option.

Step 8: If any changes are done to the code by any of the team member, others can import the changes using the option, "Pull" in the Git Pane.

Step 9: If a separate branch is maintained, you can choose to merge with the main branch using the option, "Merge" in the Git Pane.

Step 10: Use the Git History Pane in the right side, to track the commits performed by the team members.

Important Note: To perform a successful, Pull and Merge, the Commit table should be empty i.e. discard all your uncommitted changes. Pull the new code and then start your edit process.

Conclusion: Git is a powerful tool in the development and maintenance of the code esp. in team development. Effective usage of the Git VCS will help in the implementation of the solutions.
1 Comment
Labels in this area