Skip to content

Latest commit

 

History

History
107 lines (63 loc) · 2.54 KB

github_beginning.md

File metadata and controls

107 lines (63 loc) · 2.54 KB

Beginning with GitHub

If you do not have a GitHub account yet, then create it first - GitHub signup.

Steps (creating repo with README file)

  1. Create a new repository in GitHub.

  2. Using terminal or another command-line tool, create a new folder to your project in a location you want.

    mkdir your_project_name
    
  3. Get into the new project folder

    cd your_project_name
    
  4. Create a local git repository

    git init
    
  5. Connect local and remote repositories

    git remote add origin URL_TO_REPO
    
  6. Check for the changes and pull the latest code from GitHub

    git pull origin main
    
  7. Write code; make your changes. When you are done, add your changes to staging.

    git add .
    
  8. Commit your changes

    git commit -m "write a short title for your changes you are committing"
    
  9. Push your changes to the remote repository

    git push origin main
    

In a nutshell:

  • make remote repo
  • make local repo
  • connect remote and local
  • pull changes from remote to local
  • make changes and then add changes
  • commit changes
  • push changes

Steps (creating repo without README file)

  1. Create a new repository in GitHub.

  2. Using terminal or another command-line tool, create a new folder to your project in a location you want.

    mkdir your_project_name
    
  3. Get into the new project folder

    cd your_project_name
    
  4. Create a local git repository

    git init
    
  5. Add a README file

    echo "# Project title" >> README.md
    
  6. Add your changes to staging.

    git add .
    
  7. Commit your changes

    git commit -m "first init"
    
  8. Connect local and remote repositories

    git remote add origin URL_TO_REPO
    
  9. Push your changes to the remote repository

    git push origin master
    

In a nutshell:

  • make remote repo
  • make local repo
  • make README file
  • add changes
  • commit changes
  • connect remote and local
  • push changes

Everyday work with GitHub

  • pull latest code from remote repo
  • make your changes
  • add your changes to staging
  • commit your changes to staging
  • push your changes