2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 09:13:08 +00:00

Merge pull request #171 from whowutwut/git_help

Add information about stashing work before syncing forks
This commit is contained in:
Xiaopeng Wang 2015-09-11 19:44:14 +08:00
commit 79e4df3c6b

View File

@ -12,13 +12,29 @@ From time to time, your master branch will start to **fall behind** the upstream
.. image:: github-behind_master.png
Update the **master branch** of your forked copy from xcat2/xcat-core
---------------------------------------------------------------------
Temporarily Stashing work (optional)
------------------------------------
#. Pull the ahead commits from the ``upstream master`` to your local master branch. ::
If working on changes in another branch, it's recommended to stash the work before switching to the ``master`` branch so the pull does not wipe out any uncommitted changes. To stash work in the current branch:
#. Add (*not commit*) any untracked files and directories: ::
$ git add <untracked_files_and_directories>
#. Stash the work: ::
$ git stash
Switch and Update the **master branch** of your forked copy
-----------------------------------------------------------
#. Switch to the master branch. ::
$ git checkout master
#. Pull the commits from the ``upstream master`` (xcat2/xcat-core) to your local master branch. ::
$ git pull upstream master
remote: Counting objects: 38, done.
remote: Compressing objects: 100% (15/15), done.
@ -31,10 +47,12 @@ Update the **master branch** of your forked copy from xcat2/xcat-core
Fast-forward
...
#. Push the commits from your local master to your forked copy in GitHub: ::
#. Push the commits from ``upstream`` merged to your local master to your forked copy in GitHub: ::
$ git push origin master
After the Syncing
-----------------
@ -43,6 +61,8 @@ Your fork master branch should now be **even** with ``xcat2/xcat-core``
.. image:: github-even_with_master.png
Unstashing work (optional)
--------------------------
If work has been stashed, to continue back where you left off, switch to the target branch and run : ``git stash pop``