Steps to push code from Visual Studio Code to GitHub – Part 2

  1. Create a new branch in the project repository.
  2. Clone the remote repository to our local system.
  3. Switch from the main branch to the new branch
  4. Create a new project.
  5. Push the code from visual studio code to GitHub.
  6. Open a pull request.
  7. Merge the Pull request.
  8. Delete subbranch from remote repository.

The third and fourth steps of the process are covered in this article. Refer to Steps to push code from Visual Studio Code to GitHub – Part 1 for the first 2 steps in the process.

Switch from the main branch to the new branch

By default, the selected branch in your repository is usually the main branch. However, it’s
important to make sure that you are pushing your changes to the correct branch. So before
pushing your code to the remote repository, you need to switch from the main branch to the
subbranch where you want to push your code. For that do the following:

  1. Open your terminal or command prompt and navigate to the local repository
    directory.
  2. Run the following command to switch to the new branch.

git checkout name of the new branch

3. If the new branch does not exist yet, you can create it and switch to it in a single
command by running:

git checkout -b name of the new branch

Image 1

After completing these steps, you will be working on the new branch in your local
repository, and any changes you make, and commit will be made to that branch.

Image 2

You can also switch from the main branch to the subbranch using Visual Studio Code. For that do the following:

  1. Click on the ‘source control’ icon. Then click on ‘’ at the top right corner of the
    source control panel.
  2. Click the ‘checkout to’ option.
Image 3

2. Select the branch that you want to switch to.

Image 4

Now the branch is switched from the main branch to the new branch.

Image 5

You can also switch the branch using GitHub desktop application.

  1. Choose the branch to which you want to switch in the ‘Current branch‘ field.
Image 6

Now the current branch is the selected branch.

Image 7

Create a New Project

  1. Open Visual Studio Code and press Ctrl + Shift + P to open the Command Palette.
  2. Type “SuiteCloud: Create New Project” in the Command Palette and select the option from the list that appears.
Image 8

3. Open the folder where you want to create the project. Choose the local repository.

Image 9

4. Select the type of SuiteCloud project you want to create.

Image 10

5. Enter a name for your project. Here the name of the project is “OTP-4001-Basic-Search

Image 11

6. Press “Enter” to create your new SuiteCloud project. You can include unit testing with the Jest testing framework depending on your requirement.

Image 12

Now the project is created.

Image 13

You can create the folders and files in the created project.

Image 14

The future articles will address the remaining steps.

Leave a comment

Your email address will not be published. Required fields are marked *