user2834172
user2834172

Reputation: 891

phpstorm working on a branch without touching other branches

I'm new to git and branches, so maybe i just make a stupid mistake.

I have 2 branches "master" and "sockets". If i edit files in a branch and checkout to the other branch, the previous files are marked for committing.

How can i work on a branch without touching the other branch? do i need a second working directories?

Regards

Update: I ignored a file in .gitignore and phpstorm, but if i edit the ignored file and change the branch it detects the ignored file as edited and wants to commit it. Why?

Upvotes: 0

Views: 80

Answers (1)

Eran
Eran

Reputation: 393781

You have to checkout the branch you want to work on :

git checkout sokcets

Then you make your changes on that branch, and either git commit, git stash or discard those changes :

edit some files
git add something
git commit

Then you can checkout another branch :

git checkout master

Upvotes: 3

Related Questions