Github not checking if local repo has changed - github

I recently re-installed my computer,
and now I'm encountering problems with github for windows (I'll be using GFW in the rest of this text). it say's that my local repo is in sync, but even if I change things, delete files, or add files it keeps saying that it is in sync.
It does check if I make changes on a different computer and push them. but syncing then won't work, so I went to shell
there I can commit (shows in GFW that there are commits ready to be pushed), sync button in GFW still doesn't work (showing that there are problems, and I should continue in git shell). When I commit in shell says that there are changes , insertions, and deletions
Then when I want to push it says Everything up-to-date.
Anyone got any clue what is going wrong?

Check if you are actually on a branch: are your commits made on a branch, or on a "detached HEAD"? (more on this at "cannot push to GitHub: everything up-to-date").
A simple git branch can show you the active branch. If there are none, that would explain why the "sync" button is inactive. You need to fast-forward your branch to that detached HEAD.

Related

What should I do when my local branch is at merging state after I pull the remote master?

I am an Android developer, and now I am doing a lot of changes locally and are trying to synchronize the local and github side of the code after I pull the merge to merge successfully and merge the code locally and run successfully.
But when I want to push always show the picture shown in the picture, push rejected. I am very puzzled, the left side of the figure is the local change, since I was a novice, no previous to ignore the file, so a series of build files, .idea files have been submitted to see the error is to show that these files are not merged.
Now I am very puzzled, how can I solve this situation, how can I submit the local code to my github library, who can help me? Many thanks!
Screenshot:
You have commits in the remote version of master that you're pushing to that are not in your local version, and vice versa. Since Git can't resolve this diversion automatically, you can't push your local version to your remote.
You may have to git pull, or if that doesn't work, git rebase, to get your branches to line up in a way that they can be merged.

two computers on same branch don't get synced

I have a "dev" branch at work. I was working on the same branch at home, and when I committed some changes at home, my workspace at work wasn't updated. It still shows I'm on previous commit.
I'm using Eclipse.
How can I fetch at work the commit that was made at home without ruining anything?
Assuming you did a git push at home, simply do a git pull at work and you will see the changes. If you have not done a git push from home, you will have to do that first.

How can I retrieve the local changed files which I wrongly reset in git

Below is the situation which explains what's the matter about git.
I was using the 'develop' branch and already made several changes to the local files such as .sql, .java, .js...
I made a local branch called 'develop_some_future' since my boss wants to confirm my changes before merging main 'develop' repository.
Apparently my local file changes #'develop' branch have applied to 'develop_some_future' branch and I started editing local files again.
For some reason, I tried to pull the files that my co-workers already committed, but it has failed(Probably I couldn't set 'develop_some_future' branch well). So, I changed current branch to 'develop' branch and tried to pull them.
Fortunately it got worked, and then I tried to back to the 'develop_some_future' branch.
A dialog pops up suddenly while changing the branch and asked me that 'your local change for "~~~.sql" would be deleted since it's not committed yet. To avoid this, please commit that file or choose reset.'
Because I thought only '~~~.sql' would be changed to the latest committed state and that was not a problem, I selected 'reset' button, but unfortunately all local changes have gone.
Anyone knows how can I retrieve the date before reset?
I found that both 'git reflog' and 'git reset HEAD{}' commands are useful.
However, git reflog shows only commit, merge, and checkout changes and so I can't find reset status at all.
I'm afraid your files are gone for good, unless you had previously staged the file somehow (add or stash save).
If it had been staged, a blob object was created by Git which is now dangling (git fsck will tell you dangling objects). You can then resurrect the file by writing the blob's content with git cat-file to a new file.
If not, your'e screwed, and you have to do your work again.
It seems the problem arose in the first place, because you thought that unstaged/uncommitted changes belong to the current branch. They do not, and only live in the working directory. They will be carried over when switching branches (unless, of course, the same file was modified in the branch. Git will then refuse to checkout the other branch).

Egit files pushed to master don't show on github, but appear in clone of repo

Using Egit 3.0, I did a "Pull" to get latest master from github. Merged local changes into master and committed. Then did a "Push To Upstream." During the push I got a timeout warning. I could not see my commit or changed files when browsing github so I tried push again - message "Master: master up to date." Tried pull again - message "No ref to fetch from origin - everything up to date." Still not seeing changes or commit on github. Went to another machine and did a pull from master. All of the changes and new files are in that pull! I then did a new clone of the master. All the changes are in that as well. Any idea why the files are not showing up on the github site and how to get them to appear?
Github the cleared cache and fixed the problem!
I contacted support at github.com on this issue and they responding saying that they "cleared the cache." Now I can see my new and changed files on the github site. It's is more often the case that user error is responsible for issues like this, but this time it seems it was something that support needed to do.

EGit Commit to Remote Branch without Local Branch

I had a branch I was working on for a long time on my desktop. First I commit changes to my desktop's local branch, then push them to the remote branch and everything is dandy.
This morning, I was working on my laptop and selected the remote branch to change. The image below shows what my EGit repository window looked like on my laptop, except there was no local "MethodMigration" branch (there was a local master though). The remote "MethodMigration" branch had the little black check-mark next to it telling me that I'm viewing it as shown in the picture.
https://docs.google.com/file/d/0B7yGmb99B5enZm5OcTcydnEwLUE/edit (Sorry for the ghetto google drive link. I couldn't figure out how to get an image link)
Anyhow, I started adding a whole bunch of stuff. After I was done, I did a "Team->Commit->Commit & Push" after giving it a message. At that point, I remembered that I hadn't made a local branch for it yet... It told me "Nothing to push" even though a whole bunch of stuff had just been specified (which kind of makes sense since I never cloned the remote branch to make a local copy in the first place). The bad part is that all of my code was reverted back to the original "MethodMigration" remote branch code. Additionally, BitBucket shows no commits or anything.
Where did all my changed code go? Is there a way to get it back?
No worries!
You can use git reflog to find the commit id SHA of the lost commit. After that simply merge it with your local branch:
git merge <commit-id>