Reputation: 99508
When I was on a feature branch Feature123
in my local repository, i created a commit, and pushed it to github:
$ git commit -m "Feature123 add unit tests"
[Feature123 53ad59a] Feature123 add unit tests
2 files changed, 94 insertions(+), 2 deletions(-)
$ git push origin Feature123
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (10/10), 1.23 KiB | 0 bytes/s, done.
Total 10 (delta 8), reused 0 (delta 0)
remote: Resolving deltas: 100% (8/8), completed with 8 local objects.
To https://github-repo-url
93f285a..53ad59a Feature123 -> Feature123
On GitHub, I saw there is merge conflict when merging the feature branch to a branch called master
, so I had to solve the conflict locally.
I first switch to master
and pull:
$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'
$ git pull
remote: Counting objects: 931, done.
remote: Compressing objects: 100% (307/307), done.
remote: Total 931 (delta 634), reused 473 (delta 471), pack-reused 132
Receiving objects: 100% (931/931), 707.48 KiB | 0 bytes/s, done.
Resolving deltas: 100% (683/683), completed with 329 local objects.
From https://github-repo-url
e30f5fd..64f0158 master -> origin/master
12a9754..ab3ff99 B01312 -> origin/B01312
bbbb9cc..d729e42 B02481_6 -> origin/B02481_6
* [new branch] B02523 -> origin/B02523
550ca90..760be6b B03395 -> origin/B03395
fd54149..2559131 B03616 -> origin/B03616
Updating e30f5fd..64f0158
error: unable to create file dir1/file1: Permission denied
error: unable to create file dir2/file2: Permission denied
Checking out files: 100% (469/469), done.
What do the error messages "error: unable to create file dir1/file1: Permission denied" mean?
Then i wanted to switch to the feature branch, and merge, but
$ git checkout Feature123
error: Your local changes to the following files would be overwritten by checkout:
dir3/file3
dir4/file4
Please commit your changes or stash them before you can switch branches.
Aborting
Why is the
working directory of master
not clean, given that I have committed on my feature branch?
What shall I do now to merge master into my feature branch?
Upvotes: 2
Views: 9962
Reputation: 1327174
First, make sure a git checkout -- .
does work. If you still see "unable to create file... Permission denied
" error, this is generally do to:
Regarding your second checkout, you can either stash your local changes, or remove everything with git clean -ndx
(remove the -n
for the actual clean)
Upvotes: 3