ForceLearn
Learn Git Basics for Salesforce Developers

Learn Git Basics for Salesforce Developers

Learn Git Basics for Salesforce Developers

What is Git?

Git is a version control system where you can store your source code in a git repository. you can track changes made on your code compared with the previous code.

What is workflow in git?

They are working directory, staging, and git repository.
In the working directory is nothing but your local system, where you can build, modify your code.
In Staging, Then you can move code into the staging area. In order to move files, we use commit operation
In git repository, By using push command we can move source code from local repository to git repository

1. open click here to download
2. click on your operation type (Ex: I click on windows then it start downloading this git.exe file)
3. After downloading click on double click on it.
4.Install it
5. Now you successfully installed git in our local system.

Register an account in Github

register to create a new account in GitHub with the below link. If you have already a git account then login into it.
https://github.com/ click on register or login.

Create a new repository like the image below

Click on Create Repository.

You have created a new repository in GitHub

How to use gitbash?

After installing, Click on gitbash icon on your desktop and double click on it.
It will open a graphical interface to like the below image

Type: git version
to check which version of git installed in your local machine and it tells that git installed properly in your local machine
PWD is used to a directory path

mkdir Name – create a directory with Name

cd Name  — To enter into Name

Git configuration (username and password)

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

git config –list

To find the user name and email id to get git basic

How to clone a repository from GitHub to your system?

git clone https://gihub.com/XXXXXXXX // To clone

git status (to know the status)

echo “Hello Salesforce” > start.txt // to create a new file in local

git add start.txt / to add file4

git status .. ///to know files in a local folder

git commit -m “Adding start text file”

git push origin master // to add into a server

git init name // create a folder

mate file name

git add . // to add all files in a folder

rm -rf .git // to remove .git folder
rm -rf name of folder // to remove the project

Get all cheat sheet to Learn Git Basics for Salesforce Developers for github in pdf 🙂

Know more: Salesforce DX commands List

ForceLearn

Add comment