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 projectsWorking / 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 GitHub
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 hereCreating 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 :)
Top comments (14)
Git and Github are 2 different things.
How to use Git
should actually beHow to use GitHub
It's written, "here GitHub is used".
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.
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!
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!
@sloan
Thank you♥
Need more people like you♥
Git and Github are two very different things, git is used on Local machine for VCS and is a command line tool, Github is web based and uses git's version control features so that they can be used collaboratively and is GUI.
Git is focused on version control and code sharing.
While Github is focused on centralized src code hosting.
I dont intend to sound offensive or rude, but I've a humble request: please don't write low quality content and say "All you need to know about Git". Learn and USE it properly yourself first. Spend some years at least. There are FAR better articles on the internet, and so, please dont do desservice to the community by polluting the space. Read some books and good articles!
A very nice and informative tutorial
Thanks😊
Good work! Keep it up 💯
Thank you ;)
Short & simple 🌟
Thank you. Hope it helps :)
Some comments have been hidden by the post's author - find out more