-
Notifications
You must be signed in to change notification settings - Fork 3
Pushing to GitHub
This page is part of the 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
-
Use
git status
to confirm that the working directory is clean. -
Use
git branch -v
to confirm that you are in your intended local branch, such asdevelopment
. -
Assuming that you have mapped
english
to the repository (viagit remote add english https://github.com/Folds/english.git
), and that you want to push your changes to the server'sdevelopment
branch: -
Use
git push english development
to push your changes. -
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 is0272
, and the snapshot was pushed to the server'sdevelopment
branch, create a tag like named0272_development
and described asChecked in GitHub development
. -
Use
git checkout topic
to switch back to a local topic branch.