Git没有导入新提交

时间:2017-09-05 12:15:02

标签: git intellij-idea bitbucket

我是git的新手并从我的bitbucket存储库中检出了一个新项目。我使用了fetch和rebase(这是我记得的)。现在有一个新的提交,但我无法在我的机器上看到它。

git log未显示最新提交,

git status说:

rebase in progress; onto f573eda
You are currently rebasing branch 'master' on 'f573eda'.
  (all conflicts fixed: run "git rebase --continue")

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:   HandyApp/app/App_Resources/Android/app.gradle
        modified:   HandyApp/app/pages/filmdetails/filmdetails-common.css
        modified:   HandyApp/app/pages/login/login.html
        modified:   HandyApp/app/services/configuration.service.ts
        modified:   HandyApp/package.json
        modified:   server/biff-code/src/main/java/de/hud/biff/api/BiffImageApi.java

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        .vs/
        HandyApp/app/App_Resources/Android/settings.gradle
        HandyApp/app/App_Resources/Android/settings.json

no changes added to commit (use "git add" and/or "git commit -a")

新提交显示在Bitbucket中。我不想用强制拉动覆盖我的更改,而是合并它们。我安装IntelliJ IDEA,我也可以查看我的git,也没有显示新的提交。我需要手动更新吗?

----------------------------编辑------------------ ------------------

我做了git stash并获得了以下输出:

warning: LF will be replaced by CRLF in HandyApp/package.json.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in HandyApp/app/App_Resources/Android/app.gradle.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in HandyApp/package.json.
The file will have its original line endings in your working directory.
Saved working directory and index state WIP on (no branch): 6e6d982 rating and login
HEAD is now at 6e6d982 %message%

git fetch花了很长时间,当我按ctrl+c结束它时,我得到了以下输出:

remote: Counting objects: 23, done.
Unpacking objects: 100% (23/23), done.2)
remote: Compressing objects: 100% (22/22), done.
remote: Total 23 (delta 15), reused 0 (delta 0)
From %my_repo%
   6e6d982..e9cde9c  master     -> origin/master

------------------编辑2 --------------------------- ---

git log --graph --decorate --oneline --all产生:

*   e98c6fe (refs/stash) WIP on (no branch): 6e6d982 rating and login
|\
| * 936ac06 index on (no branch): 6e6d982 rating and login
|/
| * e9cde9c (origin/master, origin/HEAD) Updated images and Login.css
|/
* 6e6d982 (HEAD) rating and login
* 5580145 rating and login
* b6230b4 Add FLOAT Type and Test
* f573eda Add FLOAT Type and add rating + mapping
* 774b370 Change to new Version of Export
| * 005443e (master) login and rating system
| * 16ab9e9 Login and Rating System
| * 92be0bb initial commit
| * 25406a5 (origin/feature-angular4) Adjustments Angular 4
|/

e9cde9c是最新的提交

2 个答案:

答案 0 :(得分:2)

您可以存储您在当地的更改。

您需要先恢复rebase -

git rebase --abort

如果您为项目使用单独的分支 -

git stash
git checkout master or branch (where new project commit resides )
git pull
git checkout to branch (if you are using the same branch)
git merge branch name (where new project commit resides )
git stash apply

如果是同一个分支

git stash
git fetch
git pull branch name
git stash apply

然后检查git log,你可以看到新的提交

答案 1 :(得分:2)

首先,我们需要让你摆脱目前的变基,所以我们会跑:

git rebase --abort

您已经隐藏了您的更改,因此我们可以跳过该步骤,但如果您进行了工作副本更改,则应将其隐藏起来:

git stash

进行另一次git抓取只是为了确保您完全更新:

git fetch

签出主分支:

git checkout master

最后将来自origin / master的更改合并到您的分支中:

git merge origin/master

这应该会使您的回购更新。然后,您可以重新应用隐藏的更改:

git stash pop

你应该保持良好状态。

我建议永远不要直接向master提交以避免这些问题,分支是如此便宜和容易,真的没有理由冒险破坏你的主分支上的任何东西。根据您的团队规模,项目规模,安全要求等,至少有十几个经过验证的真实工作流程。所以环顾四周,找一个适合您团队的工作流程。