This content originally appeared on DEV Community and was authored by MD Rashid Hussain
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 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
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/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.