Saturday, September 2, 2023

GIT Commands To Commit Salesforce Changes Using Command Prompt

 


1.  Download the git. To download click on this link:

https://git-scm.com/downloads


2.  After the installation, open Command Prompt and check whether git is installed properly or not. Run this command:

git --version 


3.  Now Go to a directory where you want to clone the project from Git. Run Command:

cd foldername


4.  Next step is to initialize the Git in that folder. Run Command:

git init


5.  After the initialization is completed, then we need to clone the project from Git into our local desktop. Run Command:

git clone https://gitlab.eng.abc.com/SFstar/it-sfdc.git

(You can get this URL from your git repository)


6.  Go inside the last directory which is it-sfdc in my case. Run Command:

cd it-sfdc


7.  Next, checkout our feature branch where we need to commit our changes for the upcoming release. Run Command:

git checkout FeatureBranch_Release_12Dec2023


8.  Once the feature branch is checked out it is always recommended to pull the changes. Or lets say someone has checked out this feature branch yesterday and today he is adding his components to that branch. In that case he needs to pull the changes if some other developer has added his own components. Run Command:

git pull


9.  Now start adding your changes to the local files or replace your files with the modified code.


10. Check the status of modified files. Run Command:

Git status

At this time, we will see all the modified files names in 

red color.


11. If you have completed the modification, its time to add them. Run Command:

git add force-app/main/default/objects/ABC__c/

Or

git add .


Note: first command will add only the particular component 

i.e. ABC object but the second command will add all the 

changed components.


12. Write a command to check the status of the modified files after adding

git status

This time all the files names will come in green color.


13. Next step is to commit the changes to git. Run command: 

git commit -m "adding changes part of SF story"


14.  At the end we need to push the code. Run Command:

git push

No comments:

Post a Comment

Mostly Viewed