Rüdiger
Rüdiger

Reputation: 943

Git not importing new commits

I am new to git and checked out a new project from my bitbucket repository. I used a fetch and a rebase (that's what I remember). Now there is a new commit but I can't see it on my machine.

git log does not show the latest commit,

git status says:

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")

The new commit is shown in Bitbucket. I would like not to override my changes with a force pull, but to merge them. I install IntelliJ IDEA where I can also look up my git, also there the new commit is not shown. Do I need to update it manually?

---------------------------- Edit ------------------------------------

I did a git stash and got the following output:

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%

and a git fetch which took quite long and when I pressed ctrl+c to end it I got the following output:

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

------------------ Edit 2 ------------------------------

git log --graph --decorate --oneline --all produces:

*   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
|/

the e9cde9c is the latest commit

Upvotes: 1

Views: 224

Answers (2)

Arora20
Arora20

Reputation: 1063

you can stash the changes you have in your local.

You need to revert the rebase first -

git rebase --abort

If you using separate branch for your project -

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

If same branch

git stash
git fetch
git pull branch name
git stash apply

Then check git log, you can see new commits

Upvotes: 2

LightBender
LightBender

Reputation: 4253

First, we'll need to get you out of the current rebase, so we'll run:

git rebase --abort

You've already stashed your changes, so we can skip that step, but if you had working copy changes, you'd stash them with:

git stash

Do another git fetch just to make sure you're completely up to date:

git fetch

Checkout the master branch:

git checkout master

And finally merge the changes from origin/master into your branch:

git merge origin/master

This should bring your repo up to date. You can then re-apply the stashed changes:

git stash pop

And you should be in good shape.

I recommend never making commits directly to master in order to avoid these kinds of issues, branching is so cheap and easy there really is no reason to risk breaking anything on your master branch. There are at least a dozen tried and true workflows out there depending on your team size, your project size, security requirements, etc. So look around and find one that will work for your team.

Upvotes: 2

Related Questions