Learn Git in One Minute

Mr.Javed Multani
3 min readJun 10, 2023

๐ŸŽฏ ๐—š๐—ถ๐˜ ๐—–๐—ผ๐—บ๐—บ๐—ฎ๐—ป๐—ฑ๐˜€ ๐—ฌ๐—ผ๐˜‚ ๐—ฆ๐—ต๐—ผ๐˜‚๐—น๐—ฑ ๐—ž๐—ป๐—ผ๐˜„

๐Ÿ“Œ 1. git init

This command lets us create a new .repository

A hidden .git directory is added to the folder.

Most of the git commands do not work outside the initialized project, so this is the first command you will run in a project.

Go to project folder > run git init

๐Ÿ“Œ 2. git clone

This command creates a local copy of a remote repository.

When you clone a repo the source code gets automatically downloaded to the local machine.

This local repo will point to the remote repo and can PUSH and PULL changes to it.

๐Ÿ“Œ 3. git add

This command add your changes to a staging area where you can compare your local version with the remote repo code.

it is mandatory to stage the code before committing (push to remote) using git add command. To stage all files use (.) โ€” git add . iin the same repo.

๐Ÿ“Œ 4. git commit

This command saves your changes to your local repository.

Every time you commit you have to add a small message about the changes you made. This will help to keep track of the changes later.

๐Ÿ“Œ 5. git push

This command pushes your changes from the local repository to your remote repository. One can only push the committed changes.

It also creates the repository with the branch name you enter if the repository does not exist in the remote location.

If the branch is already connected to the remote then run โ€” git push

๐Ÿ“Œ 6. git pull

This command fetches the latest changes from the remote repository to your local.

This is helpful when multiple people are working on the same repository.

It will help to keep your local repo updated with the latest code.

If the branch is already connected to the remote then run โ€” git pull.

๐Ÿ“Œ 7. git checkout

This command helps to switch to an existing branch or create a new branch.

Before checking out make sure the branch exists in your local machine and the changes in the current branch are already staged or committed.
๐Ÿ˜Š Happy coding! ๐Ÿ’ป

--

--

Mr.Javed Multani

Software Engineer | Certified ScrumMasterยฎ (CSM) | UX Researcher | Youtuber | Tech Writer