What are we doing?

We are going to create a new git repo from an existing project

Shell quick reference

# List files
ls

# Get current directory (present working directory)
pwd

# Change to root directory
cd

# Change to a specific directory
cd code/name_of_directory

# Go UP a directory
cd ..

Add an existing project to GitHub


  • Navigate to your project folder

    cd code/my_awesome_project
    
  • Initialize a git repo

    git init
    
  • Stage and commit your changes

    # Stage all changes
    git add -A
    
    # Commit changes
    git commit -m "Message goes here"
    
  • Create a new Repository on GitHub
    • Follow this GitHub guide and create a repository with the same name as your directory my_awesome_project
  • Add remote that points to your newly created repo and push changes
    # Add remote called 'origin'
    git remote add origin https://github.com/your-username/my_awesome_project.git
    
    # Push changes to origin
    git push -u origin master
    
  • From now on, if you want to push changes to GitHub, simply

    # Stage all changes
    git add -A
    
    # Commit changes
    git commit -m "Message goes here"
    
    # Push changes to origin
    git push