What you want to do is done with a simple old branch in git.
From https://stackoverflow.com/a/166269/2126/jarpar :
Shelving is a way to save all changes to your mailbox without checking. Changes are saved on the server.
This is similar to fixing a branch and moving it to a server in git.
How to do it:
Let's say you are working on a branch of "master" and you decide to implement function X. You start well with this, but then your boss tells you that function Y should be implemented as soon as possible. Phil in the next cube above the volunteers to finish function X while you show Y. Here's what you do:
Create a new branch and switch to it:
$ git checkout -b feature-x
Commit your changes:
$ git add filethatyouchanged.cc $ git commit -m 'partial implementation of feature X'
Click on the server Phil can see:
$ git push origin feature-x
Return to the main branch (which has not changed):
$ git checkout master
You can also proactively create a new branch for function Y:
$ git checkout -b feature-y
Phil can now roll back your work with function X and choose where you left off:
phil$ git fetch origin phil$ git checkout -t origin/feature-x
Neall Jun 18 2018-10-18 14:03
source share