Last Modified on

GIT Update Remote Repository

  • avatar

Steps Before Pushing Changes to a Remote Repository

Save Your Current Changes:

  • git stash - Save your current branch changes.

Switch to Master/Main:

  • git checkout master or git checkout main - Change your branch to Master/Main.

Update Local Repository:

  • git pull - Pull all changes from the remote server.

Switch Back to Your Branch:

  • git checkout BRANCH - Replace BRANCH with your branch name (e.g., dev).

Merge Your Branch with Master/Main:

  • git merge main - Merge your branch changes with Main.

Restore Your Saved Changes:

  • git stash pop - Restore your saved changes.

Stage, Commit, and Push:

  • git add . - Stage your changes.
  • git commit -m "Your commit message" - Commit your changes with a descriptive message.
  • git push - Push your changes to the remote repository.


  • This cheatsheet is designed for team users.
  • Replace BRANCH with your actual branch name.