Git & Github
Tags: github, git, opensource
Published: 2021-01-11 09:31:11


<center>

<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1607967153359/0i82WOPh7.png" height="5000%")>
<br>
# ||||||||||||||||||||||||||||||||||||||||||||||||||
<br>
>## Installation
- Install **[Git](https://git-scm.com/)**
>>## Verify Installation
*Don’t  know if git installed successfully or not?*
 - Verify if Git is installed, by using the following command in the Git Bash Terminal : 
```
git --version
```
*This Command will return the version of git in floating digits which verifies that Git has been installed successfully*

<br>
## Get started with Git
*Don’t know where to start?, Check this easy **stepwise** guide below:*

>### 1. Create a New Folder
```
mkdir Folder
```
*This command will create a new folder named *`Folder`* in your Current Directory`(cd)`*

>>### 2. Initialise  Git
```
cd Folder/
git init
```
*This command will create a new `hidden` folder inside your `Folder`*

>>>### 3. Create `Readme.md` file
```
cat > Readme.md
```
*This command will create a new `Markdown` file namely `Readme.md` inside `Folder`*
```
Hello World!```
*Type above text or any other Markdown Text inside `Readme.md` file*
```
press ctrl+c```
*Press Ctrl+c to `save & exit` the `Readme.md` file*

>>>>### 4. Staging
```
git add .
```
*Use this command for `staging` `all` the files*<br><br>
`Or`
```
git add Readme.md
```
*Use the following command for `staging` the `Readme.md` file*

>>>>>### 5. Committing
```
git commit -m "My First Commit"
```
*Use this command to `commit` the `Readme.md` file with the `message` as  **`"My First Commit"`**. Use relevant messages while committing*

>>>>>>### 6. Remote Repository
*Here we will be using `GitHub` for the `remote repository`*
- Go to [Github](https://githhub.com/)
- Create a `new Repository` by clicking on either of these 2 buttons shown below:
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1607896770770/H7jDognMJ.png)
- After this it will redirect to a `new Repository form`, Fill the `Name` of the repository you want to give to your very first Repository *`(e.g. Understanding-git)`*
- Once the Repository is created, you will be able to see a page somewhat similar to the following screenshot :
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1607963264487/Nzam23Gt1.png)
- *In this `Screenshot`, the highlighted `Green Line` is the `Repository URL`*
- *`Copy` the `Repository URL` and add in the below command to add the `remote to origin`*
```
git remote add origin [Repository URL]
```
>>>>>>>### 7. Git Push
```
git push -u origin master
```
*This Command will `push` all the code from the `local repository` into the `remote repository`*

<br>
># Additional Commands:
*Some more commands to help you manage with your `version control` journey:*
## Git Pull
```
git pull origin master
```
*This command will `pull` the `latest changes` from the `remote repository` into the `local repository`. The remote repository code is updated continuously by various developers, hence git pull is necessary*
## Git Clone
```
git clone [repository url]
```
*This command is used to `clone` an `existing remote repository` into your computer*
## Git Status
```
git status
```
*This command find out `information` regarding what `files are modified` and what `files are there in the staging area`*
## Git Log
```
git log
```
*This command will `print out all the commits` which have been done up until now*
## New Branch
```
git branch [Branch Name]
```
*This command creates the `Branch` named as `[Branch Name]`*
## Git Checkout
```
git checkout [Branch Name]
```
*This command will `switch(checkout)` `current branch` to `[Branch Name]`*


<br>
# ||||||||||||||||||||||||||||||||||||||||||||||||||
<br>



![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1607967393015/Z1QVSUp3a.png) 
```git
CONGRATULATIONS 
¯\_(ツ)_/¯
Now you know the basics of how to use Git.
```
<br>
# ||||||||||||||||||||||||||||||||||||||||||||||||||
<br>
# TAGS:
{% tag git %}{% tag github %}{% tag opensource %}
<br>
# ||||||||||||||||||||||||||||||||||||||||||||||||||
<br>

# LINK TO MY PREVIOUS BLOG:
{% post https://dev.to/arshdeepsahni/add-new-widget-on-pressing-button-in-flutter-1fkf %}
<br>

<br>
# ||||||||||||||||||||||||||||||||||||||||||||||||||
<br>

# FOR MORE UPDATES, LET'S CONNECT:
```
GITHUB
```
{% github ArshdeepSahni/ArshdeepSahni %}
```
DEV.TO
```
{% user arshdeepsahni %}


</center>