How to use git

GIT – The easiest method (in a summary)

Create a repo on GitHub
Clone that remote repo on local PC
Write/code whatever in that folder (repo you cloned)
Push to remote repo

—–Details—–

So, step 1
–> Create a GitHub account
–> Create n…


This content originally appeared on DEV Community and was authored by MD Rashid Hussain

GIT - The easiest method (in a summary)

  1. Create a repo on GitHub
  2. Clone that remote repo on local PC
  3. Write/code whatever in that folder (repo you cloned)
  4. Push to remote repo

-----Details-----

So, step 1
--> Create a GitHub account
--> Create new repository
--> public/private (whatever you want)
--> add readme (if you want)
Create repo
Now your repo is created

Step 2 (cloning)
--> go inside your repo and click on the green button (with a download kind of sign and code written on it)
--> that will create a link, copy that link
--> open your folder where you want to keep this folder(repo)
--> right click --> open git bash
--> git clone "theLinkYouCopied"
(Link must be in quotes)
Now cloned, and since you copied from GitHub, git is already initialised in this repo.

Step 3 (that you do yourself, the productivity part) The usual coding, problem-solving stuff

Step 4 pushing to remote repo
And now whenever you feel like, code is complete, or maybe a part of it is complete, you confirm this,
but before this you need to confirm your identity

git config user.name "yourGithubUsername"
git config user.email "yourEmail"
(Whatever is in quotes must be in quotes)

Then you add the changes by

git add fileThatChanged
(file name with extension without quotes)

Example - if I have a file named test.cpp and I want to add this file, then I would write
git add test.cpp

Or if you want to add all changed files, just write

git add .
(that dot is important, meaning everything in this folder)

Now you need to commit to the changes

git commit -m "commit message"

-m for message, and commit message in quotes, this message should be short, compact but convey the changes you did
Ok, now the changes are finalised, you need to push this to your remote repo, Just write

git push

This will ask to confirm your identity, it will open your GitHub with an oAuth request, just give your GitHub credentials there.

Once authenticated, changes will be pushed to your remote origin (GitHub)


This content originally appeared on DEV Community and was authored by MD Rashid Hussain


Print Share Comment Cite Upload Translate Updates
APA

MD Rashid Hussain | Sciencx (2021-04-29T11:26:08+00:00) How to use git. Retrieved from https://www.scien.cx/2021/04/29/how-to-use-git/

MLA
" » How to use git." MD Rashid Hussain | Sciencx - Thursday April 29, 2021, https://www.scien.cx/2021/04/29/how-to-use-git/
HARVARD
MD Rashid Hussain | Sciencx Thursday April 29, 2021 » How to use git., viewed ,<https://www.scien.cx/2021/04/29/how-to-use-git/>
VANCOUVER
MD Rashid Hussain | Sciencx - » How to use git. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/29/how-to-use-git/
CHICAGO
" » How to use git." MD Rashid Hussain | Sciencx - Accessed . https://www.scien.cx/2021/04/29/how-to-use-git/
IEEE
" » How to use git." MD Rashid Hussain | Sciencx [Online]. Available: https://www.scien.cx/2021/04/29/how-to-use-git/. [Accessed: ]
rf:citation
» How to use git | MD Rashid Hussain | Sciencx | https://www.scien.cx/2021/04/29/how-to-use-git/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.