From commit to push:Understanding and Leveraging Git's Most Important Commands.

From commit to push:Understanding and Leveraging Git's Most Important Commands.

·

3 min read

Heya! hope you all are doing great. here we will take a look at Some basic and important git commands that you are going to use more often. First, we understand what is Git

What is Git?

Git is a version system control (VSC) now what is a version control system? , It is the practice of tracking and managing changes to the source code.

whatever changes you have made to the source code you can track and manage those changes.

Create directory

first, create the folder where we create the directory and named it a project. to create a directory we use the below command

mkdir project

now our new directory project is created

create new file

to create the new file

touch practice.txt

here is the snap of the file

To check the status

If you want to maintain the history of all the current directories present in the folder and add the change in the working directory to the staging area then you can use the following command

git add .

you can first use the add command and then you can use the status command which displays the state of the working directory

git add .
git status

Commit command

whatever changes you have made yet, to save that changes you to first git commit command

git commit -m"commit message"

Edit the Text file by using the vim

vi <file name>

to get into insert mode in vim press 'i' then press ESC + :x to exit.

Cat Command

it displays whatever is available in the file

cat <file name>

log command

It allows you to view the list of commits you made. it displays the commit-name,commit-id, commit date, commit message, and email-id of the developer

git log

To delete the file

to delete the file you can use the following command

rm -rf <filename>

Stash command

when you are not ready to commit changes but wish to return back to them later

git provides an easy way of stashing these uncommitted changes so that we can come later to them without unnecessary commit

git stash

push command

once you have made changes locally on your computer and you are ready to put in git for that you use the push command

git push

pull command

Download changes from remote repo like Github to your local machine.

it is the opposite of push

git pull

force push

it is used when you want to force push when the online repository contains a commit that your repository doesn't contain

git push origin -f

Thank you for your valuable time to read this article