Git and Visual Studio Online Source Control Operations

Git and Visual Studio Online Source Control Operations

Released Date: 05/16/2025
Version: NA

This document shows the operations with using git and Visual Studio online for source control operations. Generally speaking, the following are areas of the modified source codes:
  1. Modified Changes - You use the "save" option in VS codes to save.
  2. Stage Changes - You use the "git add <file>" or "git add ." to stage.
  3. Commit Changes - You use "git commit" to commit your current branch staged files.
  4. VS Online in a branch - You use "git push" to push your local committed changes to VS online. We never directly push to the main branch.
  5. VS Online in main branch - You create a pull request to get other developers to comment on your changes.  Then you can use "complete" to merge your changes in the branch with the main branch.  The complete function will also go through the pipeline to deploy to the final destination.

Before Starting to Make Changes in VS Codes

Before starting to make changes to your VS Codes locally, please bring up VS codes, In the terminal, perform the following:

  1. git checkout mainThis is to make sure you are on the main branch.
  2. git pullThis will bring down the latest main branch, and it will also synchronize with main and any sub branch and merge them.
  3. git branch -d <branch>If I previously had a branch of config\EMKChange, I should delete it if it has been pushed, pull requested and completed. You can find out all location branches by using “git branch.”
  4. git checkout -b <branch>Since we never modified the main branch, this will create a <branch> and switch to that branch. Your modification will be in this <branch>.
Now you are ready to make changes to the VS Code on your local machine.

Making Changes in VS Codes and Git Options

Saving Changes in VS Codes can be broken down into the following steps:

            Save, Stage(add), Commit, Merge(pull), Push, Create Pull Request and Complete

1.      Save: This involves clicking on the “save” or “save all” in VS Codes.  This is then considered as a “modified change.". But it is not saving to git yet.

2.      Add: This is to add the changes you made and saved (in modified changes) to the git staging area.  You can use the following command:

·               “git status”

o   This will show what branch you are on and what’s modified.

·               “git add <file>” or “git add .”

o   You can either add one changed file to the staging area or use the shortcut “git add" to add all changes to the staging.  We typically use “git add .”

o   At this moment, the changes still only reside locally.

3.      Commit: This is assuming all changes for a particular purpose are completed. When you do so, the system will prompt for a description of what you did.  Use the format decided on by the  team.

·               “git commit”

This commits all changes in the staging area and commits them locally to the commit area. It will open notepad++ with some default. Delete everything. An example follows for the first line:

                  change CustomerRecordDefaultColumn.tsx for default screen

The first line represents the title line. Press the Enter key twice to create a blank line.  Starting from the third line is the detailed description of your changes. The following are sample descriptions:

  1. Remove the FFL literal
  2. Combine City, State, Zip into one line
  3. Remove FFL field
Note that the description supports mark down syntax. So you can put “*” at the beginning of each line in the above examples to become bullet points.

4.      View Log: This is an optional step. You can use this step to get a history of everything you changed so far before going on to the next step to merge with the server.

·               “git log”

o   In the log interface, use the arrow key to scroll up and down -- don’t use the scroll bar.

o   Type “q” to quit review.

5.      Merge: This is a recommended step that allows you to merge the latest changes from VS online if you have multiple developers working on the same project.  If there’s a merge conflict, you can resolve it locally, which is much easier.  If you don’t do this, then in the next step when you push your changes, it is a lot more difficult to resolve the merge conflict online.

·               “git pull origin main”

o   This will go to the server and download the main branch, and merge with main and the current branch (e.g., config\EMKChange).

o   If it can’t merge automatically, you will have to merge it manually.

o   Again, if you don't do this step, then when you try to push to the server and it has merge conflict, it is much more difficult to resolve at that point.

6.      Repeat Steps 1-5 to make additional changes until you are ready to push your codes. You can choose to push one change at a time to make the process easier to operate.

7.      Push: This will save the changes to the server. Use the following command:

·               "git push origin <branch>"

o   The <branch> may be like “config\EMKChange.”

o   You can now click on the link in the terminal to go to VS online.

8.      Create Pull Request: In VS online, on the right side, you will see a message something like “you just push ….” And a link to allow you create the pull request.

·         The purpose of the pull request is to allow others to review your codes.  It also break down the changes that will be merged to the main in a easier to manage way.

When creating the pull request, keep the title in the Description. If you only have one commit, then the description of the commit will be at the end. Keep that. If you have multiple commits, then you should combine them.

9.      Complete: You can either complete it right away or wait for others to comment. Complete will merge your changes to the main branch.  If you get a merge conflict, you will have to manually merge it, which is not as easy as when you merge locally.

10.  Monitor: After you choose to complete, before you can pull to your local main again, you will need to wait to see if the complete is finished.  You can either wait for the email notification or go to the pipeline on VS online to see the progress.

 

Advance Options to Clean Up All Local Branches

Instead of deleting local branches one by one manually, the following PS commmand is an alternative for deleting all local branches other than main:

·               git branch | %{ $_.Trim() } | ?{ $_ -ne 'master' } | ?{ $_ -ne 'main'} | ?{ $_ -ne 'develop'} | %{ git branch -D $_ }

This command will get of all branches except main locally. We do not recommend using this option.


EMK

    • Related Articles

    • Avalara - Commit Tax Transactions

      Release Date: 4/28/23 Version: 8.6 and Above Posting Invoices to Accounts Receivable does not communicate with Avalara to commit the transaction. This is to avoid a crash in invoice posting if the application is unable to communicate with Avalara. ...
    • Avalara - Tax Commit Edit List

      Release Date: 4/28/23 Version: 8.6 and Above The Tax Commit Edit List shows a the list of transactions to be committed to Avalara using the AvaTax Service. Programs Added: AVTAXEDT CLS
    • Feature - Online Credit Card Interface Level 3 Support

      Release Date: 4/21/23 Revised Date: 12/20/23 Version: 8.5 and Above Introduction Elliott currently supports credit card level 2 transactions. This means, in addition of passing the credit card number, expiration number info when charge a credit card, ...
    • ARSRCMNT Accounts Receivable Payment Source File

      Payment Source File Application Overview This feature allows you to assign G/L accounts for various payment codes used in Elliott and the Elliott Shopping Cart. Additionally, you can set up and post to accounts for credit card surcharges and ...
    • Feature - Sales Order Import Request Date Warning

      Release Date: 6/13/19 Version: 8.2 and Up Previously users would control whether the message "Request Date Has Already Passed" was a warning or just a standard attention message through Global Setup-> Add-Ons-> Sales Order Import field 20, Ship Date ...