How do I move my current work to a subject branch?
source link: https://www.codesd.com/item/how-do-i-move-my-current-work-to-a-subject-branch.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How do I move my current work to a subject branch?
I started on a simple task in the main branch. ya' know the type of task where "this is too simple even to bother with a git branch"... the inevitable result was that now I have a lot of unfinished work in the master branch and need to work on other things. How do I move my current work to a new branch?
You can switch branches with a dirty tree, as long as the switch doesn't involve modifying dirty files. Since you're creating a new branch it's guaranteed not to:
git checkout -b new-branch
Once you've done that you can commit and switch back to master. You can also commit first, although it's slightly more work, because you need to rollback master to before the commit:
git commit
git branch new-branch
git reset --hard HEAD^
Related Articles
How do I display the current name of the git branch at the top of the page on my development website?
How do I get the current Urban URL on a branch without rendering?
How to get the absolute path of the current working directory in Objective-C?
How do I move content from my master branch to a new Git branch?
Change the current working directory to C ++
Get the current working directory in the kernel code
Change the current working directory in Java?
Java: How to prevent 'systemId' in EntityResolver # resolveEntity (String publicId, String systemId) from being absolutized to the current working directory
PHP: How to configure the current working directory to be the same as the directory running the script
How can I ensure that resque worker processes other tasks while the current job is sleeping?
How do I import a Python library from the current working directory?
How do I get the name of the current working directory (current working folder) instead of the path name?
How to change the current working directory in a bash script on Mac OS X?
In gnuplot for Windows, how can I list the files in the current / work directory?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK