Basic Git Commands

Creating a Git Repository

  1. Right click on your project folder and click “Git Bash Here”
  2. Initialize your repository with the command “git init”
  3. Go to github.com and create a new repository
  4. Put the command “git remote add origin (link to new repository)” in Git Bash
  5. Use the command “git push -u origin master”

git init: used to create a new local Git repository, can be used on both existing projects and brand new ones

git commit -m “commit message”: adds all uncommitted files to the local commit and adds a message

git remote add origin (link to GitHub repository): connects your local repository to a remote repository hosted by GitHub instead of your computer

git push -u origin master: pushes committed files to the master branch of the remote repository

git status: shows which files have and haven’t been committed and the files that Git isn’t tracking

Leave a comment

Your email address will not be published. Required fields are marked *