CLI: Popular Github Commands

  • Command to see the status of your local repository: git status

  • Command to add a file to the commit: git add fileName

    • fileName is a placeholder for the name of your actual file.

  • Command to commit the changes to your local repository: git commit -am “commit message”

    • -am tells git that you will be adding a commit message to the end of the command.

    • “Commit message” is a placeholder. You should type your own commit message surrounded by quotes.

  • Command to push changes from your local repository to the GitHub repository: git push

  • Command to pull changes to your local repository from the GitHub repository: git pull

  • Command to switch active branch: git checkout branchName

    • branchName is a placeholder for the name of the branch you wish to switch to.

    • If the desired branch was created after your last pull, you should pull again before attempting to switch to it.

  • Command to permanently discard local changes to a file: git checkout fileName

    • fileName is a placeholder for the name of your actual file

    • This permanently discards local changes.

Filter by label

There are no items with the selected labels at this time.