DEV Community

Swastika Yadav
Swastika Yadav

Posted on • Updated on

All you need to know about Git as a beginner

Alt Text
To know what is Git and what does it do. Kindly check out the last article What is Git, Why it is so important
Before getting into commands, there are a few terms to which you must be familiar.

Important Git Terminologies

  • Repository
    Repository or repo is nothing but the collection of source code or files or projects

  • Working / Current Directory
    The directory or folder in which you are currently working or where you have your latest code.

  • Branch
    The branch is essentially a unique set of code changes with a unique name. It has its own copy of the project history and develops on its own code.

  • Fork
    Creating a copy of a repository in your Git account to use the code or to make changes in it.

  • Clone
    The clone is an action of downloading an existing Git repository to your local computer. You will then have a local version of that Git repo in your local machine to work.

  • Pull Request (PR)

  • Web-based way to submit your work (called β€œpatches”) to a project. Suppose you made few changes in a project code, now you ask to pull those changes in the original project.

How to use Git

  • Git Account
    If you don't have an account then first make an account on any platform of your choice (I'll using GitHub here).

  • GitHub Download
    Make sure you download the Dekstop Github, if not click from here

  • Creating Repositories
    In the Repositories section, click on "New" and fill the details about your Repository.

  • Adding a project to new repo
    You can use the command prompt or Visual Studio Code(VS Code)
    to add a project from your local machine to GitHub.

    • If using command prompt, change into the directory where your source code is located. And for VS code, open Terminal there.
    • Create a new Repository and copy its URL.
    • The commands to push the source code in the repo are written below the Quick setup, you can have a look at the picture below.
  • Pull Request

    • Fork the repository to which you want to commit changes.
    • Click on Clone and open the file in Dekstop GitHub (make sure you have downloaded Dekstop GitHub)
    • Now, you can open the complete file in your local editor and make a new branch to commit changes.
    • Push it back to your repo by using $ git push -u origin new branch command.
    • After pushing the commit, click on Compareand you will be taken to the original repo where you wanted to commit changes
    • Write the description of your changes (optional) and click on Create Pull Request
    • The maintainers/owners of the original repo can see your contribution and accept your request to merge with the source code.

I hope all the basics are covered in the last two articles. If it helped, do tell me here.

Connect with me on: Linkedin Twitter

Okay bye! Have a good day :)

Discussion (13)

imfaber profile image
Fabrizio Meinero

Git and Github are 2 different things.
How to use Git should actually be How to use GitHub

swastika0015 profile image
Swastika Yadav Author • Edited

It's written, "here GitHub is used".

ecyrbe profile image

Please, while writting an article is not an easy task, don't missinform beginners about what they need to know.
This article should be labelled "Beginner's guide to beginner's github workflow".

This article lacks a lot of basic content to even be called a beginner's guide. The previous one does not even cover the basic philosophy behind decentralized version control systems. So when writting an article and sharing your knowledge (witch is a good intention, no doubt about it), please don't make false promises.

Thread Thread
sloan profile image

Hey there,

It's one thing to offer constructive criticism, but this is too harsh. Check out the Code of Conduct and you'll see that DEV is trying to create an empathetic community where folks speak respectfully to each other.

Please keep this in mind going forward!

Thread Thread
swastika0015 profile image
Swastika Yadav Author

Not that I owe you an explanation but
The context of "All you need to know about Git" was completely different from what you took.

All the posts I write are only for newbies and I use tags accordingly. It's not possible to add "For beginners" in every title of the post, It's the understanding sometimes people get it and sometimes not.

There are many many people (proficient in coding/ beginners) who don't even know what git is forget about using it.

My only thought was to get people started with it and further they can explore so I didn't want them to get confused with terms like "Version Control". I wanted them to just put everything they do on a platform and make their work accessible to others.

Also, what I meant by the title is -What you need to know before starting on Git and I chose GitHub explain the steps. And many people got that right.

I might be wrong with my thought but there is no article in the world which can cover all the info and the titles are used to get people read your articles and get idea about the article. It doesn't explain everything about the article.

And just one small thing. It's "which" not "witch".
I ain't a witchπŸ˜‚ (kidding)

Have a good day!

Thread Thread
swastika0015 profile image
Swastika Yadav Author

Thank youβ™₯
Need more people like youβ™₯

mindset profile image
Jayesh Tembhekar ⚑

Short & simple 🌟

swastika0015 profile image
Swastika Yadav Author

Thank you. Hope it helps :)

rakshith_2209 profile image

A very nice and informative tutorial

swastika0015 profile image
Swastika Yadav Author


vaibhavkhulbe profile image
Vaibhav Khulbe

Good work! Keep it up πŸ’―

swastika0015 profile image
Swastika Yadav Author

Thank you ;)

Some comments have been hidden by the post's author - find out more