I've been using GIT for a couple of weeks now and trying to understand how to switch branches without commiting files. This is what I have done.
What I want to do now is switch from master to Branch2. The changes I made to the master branch are for local dev purposes only and should never be committed. But when I try to do this in eclipse (i.e I double click on the local branch I try to switch to) it keeps telling me that there are uncommitted changes and I need to commit, stash or reset.
Can anyone tell me how i can make a change to a local file and have git ignore this change so that I don't get prompted with this message?
when you switch to a branch without committing changes in the old branch, git tries to merge the changes to the files in the new branch. If merging is done without any conflict, swithing branches will be successful and you can see the changes in the new branch.
To create a new branch in your repository, right click a shared project and navigate to Team => Switch to => New Branch… from the context menu. Select the branch you want to create a new branch from, hit New branch and enter a name for the new branch. The new branch should appear in the branch selection window.
When you switch branches, files that are not tracked by Git will remain untouched. Since Git does not know about new_file. dat , it will not just delete it.
Note: if you need to stash a work in progress from Eclipse, Egit now supports stash:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With