Learn Python

Learn Data Structure & Algorithm

Learn Numpy

Learn Pandas

Learn Matplotlib

Learn Seaborn

Learn Statistics

Learn Math

Learn MATLAB

Learn Machine learning

Github Introduction

git setup and configuration

Create and delete repository

Upload code using gitbash

Ignore files

Github Branch

Upload code using gitbash GUI

Learn OpenCV

Learn Deep Learning

Learn MySQL

Learn MongoDB

Learn Web scraping

Learn Excel

Learn Power BI

Learn Tableau

Learn Docker

Learn Hadoop

everything about upload code in github repository

How to upload code in a repository?


Step 1:

Create a folder to store coding files and the folder name should same as our repository name. You can create this folder anywhere in your computer.



Step 2:

Inside that folder store the coding files. Here we can multiple files.

Step 3:

Now go to your file location and do mouse right click. There you will see an option name gitbash here. Click on that. By doing this you are opening you gitbash in your file location.

Step 4:

Now you have to initialize your code.
To initialize
The command:
git init

Let's check the current status.
So the command:
git status

How to ignore files?
Suppose you have 10 files among them you don't want to upload 2 files. In this case you will ignore those two files.

Step 5:

Now you have to take your file in staging area. Here you will select those files which you want to upload on github.

Add a specific file
git add filename.extension

Add all files from both directory and subdirectory:
git add -A

Add all files only from directory, not from subdirectory:
git add .

Add all file which have a specific extension present only in directory:
git add *.extension
example,
git add *.js
git add *.css
git add *.py

Add all file which have a specific extension present in both directory and subdirectory:
git add **/*.extension
example,
git add **/*.js
git add **/*.css
git add **/*.py
In this example we will upload all the files present in directory:
So the command:
git add .

Step 6:

Let's check the current status.
So the command:
git status

Step 7:

Now you have to do commit. In the command of commit pass a message. You can write anything but it is better to give a meaningful message related with your work. For example: adding the main file.
Command to commit:
git commit -m "adding the main file"

Command to see commit history:
git log

Step 8:



Now you have to connect local repository(folder where you have your all files) with the remote repository( github repository).
Command:
git remote add origin repository_url

In the command after origin pass your repository url.

To get the url, at first go to your repository code tab. There you will find the url of the repository(green marked in the image).

In this example the command will be:
git remote add origin https://github.com/Rafsun001/github_practise.git

Let's check the connection details.
Command to check the connection details:
git remote -v

Step 9:

Now we have to push the files to the repository.
Command to push:
git push -u origin main

Now check you github repository. You will see your files.

Image of all the process in gitbash


How to pull or update or add the changes done in github files to your local repository?

Suppose someone did some changes on a html file present in github repository. Now you want to add that update of code on the same file which is present in your computer so that you can continue your work.
To do this command:
git pull

CodersAim is created for learning and training a self learner to become a professional from beginner. While using CodersAim, you agree to have read and accepted our terms of use, privacy policy, Contact Us

© Copyright All rights reserved www.CodersAim.com. Developed by CodersAim.