I have a project. Located in the Project
folder. Initializing Git, I create a new branch:
git init
Git Add.
Git Commit -m 'First Commit'
Git Branch Feature.
// Do something for Feature
What have I have? Two branches. One – Master
. Other – Feature.
They are distinguished.
I changed some files in the Project
folder (while I worked in the Feature
branch). But here it was very necessary to take a look at the files that in Master
.
How to make in the Project
folder there are not those files that I now work on Feature
, but those that were in the Master
?
Answer 1, Authority 100%
If you already have a branch Feature
, then after the commit to it, make Git Checkout Master
– this will switch the current branch to Master
.
While you have not made the changes, you cannot switch to another branch. Output two: composing changes or postpone them. The second can be done using Git Stash
– this will add current uncomplete changes to the stack of change and reset the current workflow to head
and the repository. Next you can:
Git Stash List
: show all changes in the stackGit Stash Show
: show the last change in the stack (patch)Git Stash Apply
: Apply the last change from the stack to the current working copyGit Stash Drop
: Remove the last change in the stackGit Stash Pop
: Apply the last change from the stack to the current working copy and remove it from theGit Stash Clear
: Clean the Stack of Changes
stack>