0

我对 GitHub 有点纠结(对于 Mac,虽然我怀疑这是否相关)。

我只是最近才改用 Git,所以它在许多方面仍然是一个未知数,今天是我第一次有理由同时激活两个分支。

我不确定发生了什么,但是其中一个分支和 master 之间的合并没有按计划进行(不知何故,提交摘要在将 hotfix_7.0 与 master 合并时丢失了),所以我取消了提交。然而,随后出现了问题。

分支 update_4.0 包括:

application/modules/bookings/controllers/inspector.php
application/modules/bookings/models/data_bookings.php
application/modules/bookings/views/users/administrators/bookings/adjust.php
application/modules/invoices/controllers/invoices.php
application/modules/invoices/views/manage.php
application/modules/search/controllers/assets/invoices.php
application/modules/search/models/data_search.php

分支 hotfix_7.0 包括:

application/modules/bookings/controllers/bookings.php
application/modules/bookings/controllers/inspector.php
application/modules/search/models/data_search.php
application/modules/venues/models/data_venues.php

当我切换到 update_4.0 时,没有等待提交的文件,hotfix_7.0 也是如此。但是当我切换到 master 时,update_4.0 的文件显示为等待提交。为什么?而且——更重要的是——我接下来应该做什么来补救这个问题?

更新:根据@twalberg 的要求,这里是分支结构数据:

* 869e2f1 (HEAD, origin/hotfix_7.0, master, hotfix_7.0) An adjustment to the Search
| * c1e4c04 (update_4.0) Adjustments to Bookings, Invoicing, and Search
|/  
* d2413f9 (origin/master, update_3.0) Update an Invoice PDF
* 6a77f1e (hotfix_6.0) General fixes
* fb04b7e (update_2.0) Advanced Search
* c8222fe (hotfix_5.0) Caching
* 3baea6a (feature_5.0) Caching
| *-.   5c08c19 (refs/stash) On hotfix_4.0: GitHub: stashing before switching branches.
| |\ \  
|/ / /  
| | * 9a6cd92 untracked files on hotfix_4.0: 0ed797b Invoice date range
| * e7e4bbd index on hotfix_4.0: 0ed797b Invoice date range
|/  
* 0ed797b (hotfix_4.0) Invoice date range
* 4d9640d (hotfix_3.0) A fix to one of the search functions database methods, and the incl
* 8ee9f92 (feature_4.0) Users can now switch between Clients from anywhere in the system w
* 8d8752a (feature_3.0) In an effort to improve the invoicing process, I've made several a
* 2cff420 (hotfix_2.0) Switching references to the Commission for Venues column in Invoici
* 2403093 (feature_2.0) Statuses for Signatures, which allows the User to filter them in m
* 6572680 (hotfix_1.0) A conditional statement was checking against a string value as if i
* 6705899 (update_1.0) Alphabetical listing of Signatures for messages.
* 283bde4 (feature_1.0) Ability to edit group options in addition to group privileges for 
* 79ded64 To Book 3

更新:根据@Ilion 的要求,这里是分支结构数据:

# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   application/modules/bookings/controllers/inspector.php
#   modified:   application/modules/bookings/models/data_bookings.php
#   modified:   application/modules/bookings/views/users/administrators/bookings/adjust.php
#   modified:   application/modules/invoices/controllers/invoices.php
#   modified:   application/modules/invoices/views/manage.php
#   modified:   application/modules/search/controllers/assets/invoices.php
#   modified:   application/modules/search/models/data_search.php
4

1 回答 1

0

至于为什么,我在子模块文件夹中看到了这种行为——更改为没有它们的分支并且它们没有被删除——但我不希望 git 的新手使用子模块。无论如何,这只会显示子模块文件夹,而不是子模块中的文件。

您的第二个问题的直接答案,如果您不想要更改,您可以使用以下命令摆脱它们。

如果等待提交的文件缓存在索引中(就像它们在之后一样git add .,您可以使用以下命令将它们从索引中删除:

git rm -r --cached .

如果它们没有被索引,您可以使用以下方法永久删除它们,有时需要运行两次(例如第一次删除.gitignore文件时)。

git clean -fd

下一步要做什么的更长期的答案取决于你想在哪里结束。我们可以在您的日志输出中看到提交和分支,而从您的帖子来看,这不是您想要的方式。那么,你希望它是怎样的呢?

于 2013-01-18T03:21:43.350 回答