Skip to main content

Command Palette

Search for a command to run...

Git for Beginners

Published
•2 min read•View as Markdown
Git for Beginners

what is git ?

  1. Git is a version control system. In simple Git is a tool that keeps track of changes in our code like who changed what and go back to old code. It help multiple people work together in a single time.

Every developer has a full copy of the project history on their own computer. It minimise the dependencies.

Git Basics and Core Terminologies ?

  1. Repository (Repo)

    It is like a folder used to store , manage and track changes on data. Give freedom to developers work collaboratively.

  2. Commit

    It is basically like a snapsort to memorise what changes perform in files and save with a comment to better understanding.

  3. Branch

    Branch is the movable point of a commit , It allow you to separate yourself and make work on new feature, fix bug and experiment on new ideas.

    It doesn’t affect the main project.

Head

Head is a point where you right now. It points to last commit of current branch.

Common Git Commands

1. git init
It initializes Git in the current folder and makes it a Git repository.

2. git status
It shows the current status of files (untracked, modified, staged).

3. git add file_name
It adds a specific file to the staging area.

4. git add .
It adds all files to the staging area.

5. git commit -m “message“
It saves the staged changes permanently with a message.

6. git log
It shows the history of all commits.

7. git log —oneline
It shows commit history in short form.

8. git branch
It shows the current branch.

9. git remote add origin URL
It connects the local repository to a remote GitHub repository.

10. git remote -v
It shows the connected remote repository URLs.

11. git push -u origin main
It upload commits to the GitHub repository.

12. git pull origin main
It downloads code from GitHub.

13. git clone URL
It copies a GitHub repository to your system.