开发者

git create branch with untracked files

开发者 https://www.devze.com 2022-12-27 04:03 出处:网络
I\'ve a master branch with a .gitignore file with directory X listed in it. (X is not being tracked).

I've a master branch with a .gitignore file with directory X listed in it. (X is not being tracked).

When I try to add a branch tracking a remote using the command

git checkout -b mybranch origin/mybranch

The remote branch is tracking X directory, and hence this check开发者_如何学编程out fails with the error

Untracked working tree file 'X' would be overwritten by merge.

What is the way out ?

Also I'd like to know how do i untrack some files in all the branches (local and remote alike) ?

Surya


I guess the simplest thing would be to just rename your local X directory (and edit its .gitignore entry).

For untracking, you have to execute git rm --cached filename. This will remove the file from the Git index, but does not delete it from the file system. Next step, you have to add it to .gitignore.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号