Skip to content

asaldelkhosh/Git-Learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Basic steps to use git and github


Start using Git and Github

  1. Creating a Repository in Github
  2. Opening a bash (terminal, gitbash, ...)
  3. Clone the created repository into my computer
  4. Adding my changes
  5. Commiting my changes
  6. Pushing my changes into Github
  1. Creating a Repository in Github
  2. Opening a bash (terminal, gitbash, ...)
  3. Create git files in my system
  4. Connecting my system git to Github repository
  5. Pulling the Github data
  6. Adding everything to repository
  7. Push everything to Github

Others


What is Star?

If you like a repository, you can give an star to that repository. Just like giving a like to a post in instagram. You just have to click on the star logo.


What is Fork?

You can copy someones repository into your own repositories by clicking the fork.


How can you see your commits?

In your repository, click here:


How can I change private repository to public?

Go to repository and go to Settings section:

Scroll to bottom and to go this section:

Click change visibility and choose public mode, enter the repository and click what it says.



How can I do it?

Basic level

Creating a Repository in Github

Open Github and go to Repositories section, then click new.

You have to give your repository a name and a description.

In the next session you can choose your repository to be public (people will see this) or private (people won't see this).

You can create a README.md for your repository, this file allows you to write some information about your repository, so that other people can read it and undrestand the purpose of your repository.

Click the create button and we are done :D


Opening a bash

If you are using Windows right click on the screen and choose git bash.
If you are using Linux / MacOS right click on the screen and choose open terminal.

Clone the created repository into my computer

Open your Github repository and copy the address from here:

You have to copy this:

Enter the following command:

git clone ADDRESS-FROM-GITHUB

Adding my changes

When you made your changes, you have to add them by the following command:

git add .

Commiting my changes

After you add your changes, you have to commit them with a message:

git commit -m "for example: add main.py file ..."

Pushing my changes into Github

Now push your commits to the Github repository:

git push origin master

Advance level

Create git files in my system

Enter the following command:

git init

Connecting my system git to Github repository

Open your Github repository and copy the address from here:

You have to copy this:

Now enter the following command to set the origin remote:

git remote add origin ADDRESS-FROM-GITHUB

Pulling the Github data

Now enter the following command to pull the repository data:

git pull --allow-unrelated-histories ADDRESS-FROM-GITHUB

In case you stuck in vim, first click esc and then enter :wq.

Adding everything to repository

You have to add everything to git repo:

git add .

And make a commit:

git commit -m "merge git repo"

Push everything to Github

Push everything to github:

git push origin master

About

Basic steps to use git and github.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages