命令和API之间有什么区别来创建一个新的核心?(What are the differences between the command and the API to create a new core?)
通过运行以下命令我可以创建一个新的内核。
$ ./bin/solr create -c newcore Setup new core instance directory: /Users/myname/Documents/solr/solr-5.2.1/server/solr/newcore Creating new core 'newcore' using command: http://localhost:8983/solr/admin/cores?action=CREATE&name=newcore&instanceDir=newcore { "responseHeader":{ "status":0, "QTime":916}, "core":"newcore"}
但是,我无法通过消息所述的API创建新的内核。
$ curl -X GET 'http://localhost:8983/solr/admin/cores?action=CREATE&name=newcore2&instanceDir=newcore2' <?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"><int name="status">400</int><int name="QTime">361</int></lst><lst name="error"><str name="msg">Error CREATEing SolrCore 'newcore2': Unable to create core [newcore2] Caused by: Can't find resource 'solrconfig.xml' in classpath or '/Users/myname/Documents/solr/solr-5.2.1/server/solr/newcore2/conf'</str><int name="code">400</int></lst> </response>
这两种创建核心的方式有什么不同? 我明白为什么会发生这种情况的错误。 命令的过程与API的过程不一样吗? 我正在使用solr-5.2.1。
I could create a new core by running the following command.
$ ./bin/solr create -c newcore Setup new core instance directory: /Users/myname/Documents/solr/solr-5.2.1/server/solr/newcore Creating new core 'newcore' using command: http://localhost:8983/solr/admin/cores?action=CREATE&name=newcore&instanceDir=newcore { "responseHeader":{ "status":0, "QTime":916}, "core":"newcore"}
However, I couldn't create a new core through the API that the message said.
$ curl -X GET 'http://localhost:8983/solr/admin/cores?action=CREATE&name=newcore2&instanceDir=newcore2' <?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"><int name="status">400</int><int name="QTime">361</int></lst><lst name="error"><str name="msg">Error CREATEing SolrCore 'newcore2': Unable to create core [newcore2] Caused by: Can't find resource 'solrconfig.xml' in classpath or '/Users/myname/Documents/solr/solr-5.2.1/server/solr/newcore2/conf'</str><int name="code">400</int></lst> </response>
What are the differences between these two ways to create a core? I understand why the error occurs this case. Is the process of the command not the same as the process of the API? I'm using solr-5.2.1.
原文:https://stackoverflow.com/questions/42434679
最满意答案
首先,由于您已经完成了本地主分支的所有工作,因此请创建一个指向提示或本地主分支的新功能分支。
$ git checkout -b newfeature master
然后将它保留在服务器中(远程)
$ git checkout master $ git reset --hard origin/master
I am not sure what happened, but when I followed the git commands by KurzedMetal it didnt give me the desired result.
So I saw no other option than re-doing my changes, despite having taken a backup prior to doing a hard reset back to remote master as well as my export of changed files. Both the export and the backup were worthless as they contained the exact same content as my local repository afterwards, thus my changes were lost. I had expected both to be unchanged.
Luckily, I had stashed my changes before I began on my push problem.
Note: Newly created files were not removed after the hard reset.Here are my steps to fix:
- Finished you changes (still in master)
- Pull new changes from remote master and fix any conflicts
TortoiseGit -> Stash save
. Enter a message to distinct it from other stashes -> OkTortoiseGit -> Show log
. Select newest master, then right-click and selectReset
, then theHard option
-> OkTortoiseGit -> Create Branch
. Enter a name and check the boxSwitch to new branch
-> OkTortoiseGit -> Stash list
. Select your saved stash -> Ok- Now you see a list of different files. For each file, compare the differences and apply the changes again to newly reset files
- When done, right-click inside your local folder. You should see
Git Commit -> "BranchName" ...
aboveTortoiseGit
, choose the first- Confirm which files to commit and then enter a fitting description -> Ok
- Now you are ready to
push
.TortoiseGit -> Push
, check that the local branch is your chosen name. If its not, then you forgot to switch branch in 5. and have to continue from 6.I hope this will help others. The thing to remember: Switch to a new branch when you begin a new feature / non-minor change
相关问答
更多-
在git中切换分支(Switching branches in git)[2021-02-19]
正如Devin Ceartas提到的那样,当切换分支会改变你已经在本地更改过的某个文件时会发生这种情况。 (当你对一个不会改变的文件进行本地修改,或者添加既不存在于分支也不是master的新文件时,Git不会投诉。) 解决方法有两种: “git藏起来”你的改变,改变主人,和“git藏匿适用”。 然后提交更改。 在分支上提交所需的更改,然后“git藏匿”任何其他更改(如果有),更改为master,并在master上挑选更改。 As Devin Ceartas mentioned, this happens w ... -
你需要一个干净的状态来改变分支。 分支检查只有在不影响“脏文件”的情况下才能被允许(正如Charles Bailey在评论中所说的那样)。 否则,您应该: 藏起你目前的变化 reset --hard HEAD (如果你不介意丢失这些微小的变化)或 checkout -f (切换分支时,即使索引或工作树与HEAD不同,也可以继续进行,这用于丢弃本地更改。) You need a clean state to change branches. The branch checkout will only be a ...
-
尝试这个而不是git checkout : git symbolic-ref HEAD refs/heads/develop 那么你应该可以删除主。 Try this instead of git checkout: git symbolic-ref HEAD refs/heads/develop Then you should be able to delete master.
-
是的,你可以这样做。 git symbolic-ref HEAD refs/heads/otherbranch 如果您需要在此分支上提交,您将需要重置索引,否则您将最终根据上次签出的分支提交某些内容。 git reset Yes, you can do this. git symbolic-ref HEAD refs/heads/otherbranch If you need to commit on this branch, you'll want to reset the index too ot ...
-
最近的git版本有足够的DWIM(“做我的意思!”)逻辑来理解你只是在做: git checkout branch1 在那个场合。 如果没有名为branch1本地分支,并且只有一个以branch1结尾的远程跟踪分支,那么这将起作用 - 在这种情况下,它等于较长的分支: git checkout --track -b branch1 origin/branch1 ...应该在任何情况下都有效。 我意识到我错过了回答你以后的一些问题。 git将来自origin资源库的分支状态存储在所谓的“远程跟踪分支”中 ...
-
Git - 忘记切换分支(Git - Forgot to switch branch)[2022-10-07]
首先,由于您已经完成了本地主分支的所有工作,因此请创建一个指向提示或本地主分支的新功能分支。 $ git checkout -b newfeature master 然后将它保留在服务器中(远程) $ git checkout master $ git reset --hard origin/master I am not sure what happened, but when I followed the git commands by KurzedMetal it didnt give me th ... -
我可以通过git-stash获取文件: https : //git-scm.com/docs/git-stash 看起来这是一个正常的行为,正如所解释的,这是可能的重复: Git删除忽略的文件,当我切换分支 请不要说我有时使用Github App for Mac OS来提交/切换分支。 不知道它是否起作用。 I could get the file back via git-stash : https://git-scm.com/docs/git-stash It seems that it is a no ...
-
如果你想交换分支的名称,可能最简单的方法是: git checkout --detach master # we put HEAD on master git branch -f master project # move master to project (HEAD doesn't move) git branch -f project # set project to HEAD git checkout project If you want to exchange the name of the ...
-
在Git中切换远程分支(Switch remote branch in Git)[2023-06-10]
您不克隆您克隆完整存储库的分支,并将本地分支与远程分支连接。 最好的方法是建立一个本地分支。 git branch master -t origin/master 使用该行,您可以将本地分支主服务器与远程分支主服务器连接起来(如果当时不存在)。 然后你可以结账并切换那个分支。 通常,主分支可用,您可以通过结帐将结账切换到另一个分支。 git checkout newbranch You don't clone a branch you clone the complete repository and ... -
如何在切换git分支时切换maven本地存储库缓存(how to switch maven local repository cache when git branch is switched)[2022-08-05]
我将此作为单独的答案添加,因为我认为它确实是最干净和最简单的解决方案,而且没有使用多个本地maven存储库的“技巧”。 简而言之 - 您需要在每个分支中使用不同的工件版本控制。 一个简单的约定可能是: BRANCH-XYZ[-SNAPSHOT] 。 例如: develop分支:0.0.1-SNAPSHOT abc branch:ABC-0.0.1-SNAPSHOT xyz branch:XYZ-0.0.1-S ...