Harish
Posted on September 25, 2022
Git is an version controller tool developed by legend Linus Torvalds, which helps Developer tracking changes in any set of files, sometimes its a life saver, believe me
Learn Git fundamentals in this short blog OR use it as a
cheatsheet for future references.
First initialize the present local directory
git init
Write some code
Stage the code to commit
- Stage all files
git add .
- Stage a specfic file
git add file.html
- Unstage a file
$ git restore — staged name.txt
Now commit the staged code
with a commit message for future references
git commit -m "First Git commit"
We can check commited code status by
```
git status
```
Check history of your commits
```
git log
```
Upload files to your Github Account
Now connect your Github Account and upload your files.
- First, we need to create a Github repository
- Copy the HTTPS link of your repository
- Now add remote access to your GitHub repository
git remote add origin https://github.com/sheoranharis/sheoranharis.git
**origin** is name of the link to your repo
- Create a branch by which you will push your code to the repo
git checkout -b mybranch
-
We need remote access to our Github Account
First, generate a SSH Key -
Github Docsthen add this SSH key to your Github account -
Github Docs
OR
If you are using VS code, just login into VScode by your Github account
and you are good to go.
Push your code to Github using Git
git push origin mybranch
We are pushing our code by mybranch to origin
Check your Github account to see changes
See you in next blog.....Lets Connect
Posted on September 25, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 29, 2024