GIT:以下未跟踪的工作树文件将被checkout覆盖 [英] GIT: The following untracked working tree files would be overwritten by checkout

查看:742
本文介绍了GIT:以下未跟踪的工作树文件将被checkout覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个分支,一个叫master,另一个叫dev
我目前在master分支,我想去dev分支将文件移动到开发服务器。然而当我执行

  $ git checkout dev 

我得到以下消息:

lockquote

以下未跟踪的工作树文件将被
结帐:

  pages / memclub / images / subheaders / leadership.png 
pages / memclub / images / subheaders / male.png
pages / memclub / images / subheaders / marketing.png
pages / memclub / images / subheaders / training.png


我不想将这些文件提交给主服务器,他们还没准备好推送。

解决方案

首先,您需要添加有问题的文件,以便Git跟踪它们(您没有Git需要知道这些文件):

  git add pages / memclub / images / subheaders / leadership .png pages / memclub / images / subheaders / male.png 
git add pages / memclub / images / subheaders / marketing.png pages / memclub / images / subheaders / training.png

然后您可以隐藏您的更改:

  git stash 

当您准备再次开始处理文件时,您可以使用:

  git stash pop 


I have two branches one is called master the other is called dev I am currently in the master branch and I want to go to the dev branch to move a file to the development server. however when I perform a

$ git checkout dev

I get the message:

The following untracked working tree files would be overwritten by checkout:

pages/memclub/images/subheaders/leadership.png
pages/memclub/images/subheaders/male.png
pages/memclub/images/subheaders/marketing.png
pages/memclub/images/subheaders/training.png

I dont want to commit the files to the master, they are not ready to be pushed.

解决方案

First you'll want to add the files in question so that they're tracked by Git (you don't have to commit any changes, but Git needs to know about the files):

git add pages/memclub/images/subheaders/leadership.png pages/memclub/images/subheaders/male.png 
git add pages/memclub/images/subheaders/marketing.png pages/memclub/images/subheaders/training.png

Then you can stash your changes:

git stash 

When you're ready to start working on the files again, you can use:

git stash pop

这篇关于GIT:以下未跟踪的工作树文件将被checkout覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆