Skip to content

Instantly share code, notes, and snippets.

@acidtone
Last active September 26, 2021 06:46
Show Gist options
  • Save acidtone/4f6bf60c175cbbdde7107ba1a697e731 to your computer and use it in GitHub Desktop.
Save acidtone/4f6bf60c175cbbdde7107ba1a697e731 to your computer and use it in GitHub Desktop.
Git Activity: Push local changes to GitHub

Git Activity: Push commits to a remote repo

  1. Create a GitHub repository
  2. Clone a GitHub repository
  3. Add an empty webpage to a local repo
  4. Commit changes to index.html.
  5. push local changes to GitHub.
  6. Deploy your GitHub repo to GitHub Pages.

Pre-requisites

  • You have a local commits that have not been pushed.

Instructions

  1. Check your repo status.

    $ git status
    

    You need to be ahead of your remote repo by at least 1 commit (otherwise, there's nothing to push):

    On branch main
    Your branch is ahead of 'origin/main' by 1 commit.
        (use "git push" to publish your local commits)
    
    nothing to commit, working tree clean
    
  2. push your changes:

    $ git push
    

    Your latest commits will be synced with the remote repo:

    Enumerating objects: 4, done.
    Counting objects: 100% (4/4), done.
    Delta compression using up to 4 threads
    Compressing objects: 100% (3/3), done.
    Writing objects: 100% (3/3), 449 bytes | 449.00 KiB/s, done.
    Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
    To github.com:USERNAME/REPOSITORY.git
      16e6466..169a1b0  main -> main
    
  3. Check your repo status (just in case).

    $ git status
    

    You should now be up to date with your remote repo:

    On branch main
    Your branch is up to date with 'origin/main'.
    
    nothing to commit, working tree clean
    

Next Steps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment