Skip to content
Folds edited this page Jun 30, 2017 · 3 revisions

This page is part of the Plain English programming language's Git Cheat Sheet.
This page shows how to push a branch to a remote repository, such as GitHub.

Caution: Do not move a branch backwards across a GitHub cloning step. In other words, it is OK to move branches back and forth within the portion of your local repository's history that is more recent than the last time you pushed to or pulled from GitHub.

1-12. Fast-forward the local branch, so that it is at the snapshot you want to push to the remote repository. (You can also move a local branch backwards.) For example, if you started in the topic branch, and want to promote it to be your local development branch: git commit git status (and verify that the working directory is clean.) git branch -v (and verify that topic is the current branch.) git checkout development git merge topic

  1. Use git status to confirm that the working directory is clean.

  2. Use git branch -v to confirm that you are in your intended local branch, such as development.

  3. Assuming that you have mapped english to the repository (via git remote add english https://github.com/Folds/english.git), and that you want to push your changes to the server's development branch:

  4. Use git push english development to push your changes.

  5. Use gitk to tag the current local snapshot. The purpose of the tag is to prevent accidentally moving a branch backwards through this snapshot (which has been pushed to the server). For example, if the next build number is 0272, and the snapshot was pushed to the server's development branch, create a tag like named 0272_development and described as Checked in GitHub development.

  6. Use git checkout topic to switch back to a local topic branch.