Steps to Understand GIT Commands (beginner's guide)
Introduction to Git version control

Search for a command to run...
Introduction to Git version control

No comments yet. Be the first to comment.
For Each Loop and Iterators in Lightning Web Components Hello, people here I'm going to explain to you how to render the list in LWC. I will create two examples from the hardcode JS object and get the list from the server side. Let's follow some step...

My Background I am Harshit Saxena currently working as a salesforce developer. Mostly working on LWC on the community platform. I'm 2x certified: B2B commerce admin and Platform Developer 1. I was not into programming from the beginning But 2 of my s...

Git was created by Linus Torvalds about 10 years ago. The reason behind creating GIT was he hated doing source control management, imagine your day without version control or source management like, " who coded that and who made changes on that method" Terrible right! so, Linus thought of creating a systematic environment that can take care of changes and code that is made by several of my teammates.
Git has its own learning curve, I faced many problems at the beginning of my programming journey, as nowadays Git is like a global standard like anybody who can code should know Git, and know how to manage code with multiple teammates and should not mess up the whole codebase, cause I've created many issues for my senior teammates but they were very helpful to correct me, and they've explained me the best practices for git, and I'm going to tell you all that.
Repository or (repo) in Git is a collection of files and folders where your whole codebase is located. You can create Unlimited public/private repositories and can create Unlimited Branches.
Branch in Git is the same as you're thinking right now I suppose, Let's take an example of a tree and its branches with leaves.
| Example: | |
| Trees | Repositories |
| Branch | Branch |
| Leaves | People |
The repository is like a tree where everything happens where fruit will emerge and grow and at the end, it will ripe.
The branch is for different things happening at a different pace, but everything is related to the tree, for example, you cannot expect to have an apple on one branch and mango on another, cause the tree is of the same codebase, either it will have mango or apple.
you can perform different tasks on different branches of the same repository and both the task will eventually be merged into one sample master branch which is the root of all branches
And lastly, Leaves are the people that are connected to that specific repository and you can have an unlimited number of people (leaves) to your branch Repository.
here are some commands that you'll be going to use at the beginning of any project or any codebase. they are in no specific order
\==> Note: The staging area is the area where all the files are ready to be committed
git clone " < URL > "
To clone the global repository on your local machine.
git config —global username “Harshit Saxena”
git config —global.email “harshit@harshitsaxena.com”
This is to tell git who you are your username, email, address, etc. this information is used during your commits.
git add < filename >
Files that you want to commit to your repository or ready to be staged
git add --all
git add “*.txt”
To add all the text file
git add < directory >/
To add the specific directory to be staged
git commit
commit command is used to send your code to your local repository
git commit -m "write your comment here describing your commit"
git push origin master
This is used to push your code from the local repository to the Global repository
git pull origin master
To get all the code from the Global repository to your local repository
git status
git branch
git checkout -b < branchname>
git checkout < branchname >
git merge
git log
git grep " specific content "
---> These are some commands that will be helpful in your git journey, So in the end I must say to make repositories you will mess up many times but you will learn from your mistakes, that is what really counts. Believe me, I've made mistakes on client repositories in the first week of my job, but learning from your mistakes makes you better at anything. So keep on trying new things.
But try making mistakes on your local repository rather than on the client's repository.
You can find my GitHub profile on my Hashnode Profile.
Git is a very powerful tool for any programmer (experienced / beginner), so I strongly encourage you to get your hands dirty with git. Make a GitHub profile and start coding. Feel free to add your GitHub profile in the comment section. I definitely get back to you with some special tricks that might speed up your process 😉.