Losing changs during github stages, commit and push to the repository - github

Iam using git and github with vscode,
I stashed changes , committed them and pushed them into my repository, using push to.
All the steps had done without any git command in terminal,
My problem is all my changs have not showing on the repository and my new changs had deleted from vscode.
Why this happening?
can i restore my changs into vscode?
I make the same steps everytime and i never faced this problem,
Could any one explain what happened and helps me.
Thanks in advance.

Related

GitHub Desktop Stuck on Pushing To Origin

When I tried to push to remote repository using GitHub Desktop Application, it stuck on Pushing to origin.
How to solve this? I tried reinstall but that does not fix the issue.
check if you have saved all the changes that you made recently or not.
for that type git add. (Dot is mandatory)
after adding commit the changes git commit
now all changes have came to staging area, now you can push the files..
Hope it helps you...
correct me if i am wrong.

Github Site shows deleted commit in the commit tab

I am new to github commands and I am a bit confused about what I am doing.
I want to delete the "MegaMan Game" commit, revert all changes, and make it dissapear from github
history. Following this other stack overflow question Delete commits from a branch in Git, I ran the git reset --hard HEAD ~1 command. The commit seems to be deleted judging by the git log command, but on the github website it still shows that the "MegaMan Game" commit is still there. Also in source tree happens the same thing. The commit still shows there.
I am a bit confused. Is the website wrong about the commits? Did I run the command wrong?
Here is an image with the exact commands and what git
This is a noob question. I need help to undestand how this works.
You deleted commit in your local branch. You must send this change to the upstream branch(to github).
git push --force

GitHub - no changes seen after successful commit

I'm struggling with an issue connected to GitHub. I've committed some changes using GitBash console and got an info that the push was successful and there's nothing to commit. When I went into logs, there was this particular log looking like this:
The issue is that when I go back into my GitHub account, I can see just an initial commit in there, nothing more.
And the console clearly says that the commit was successful.
Please help!
Git is a distributed version control system, so you have one local copy of the repository, Github has another copy. As far as git is concerned every copy is equally important.
For your changes to exist in Github, you have to push them there, with something like:
git push origin master
Try git remote -v to get more information on your tracked repositories. Github has some great help pages on this stuff.
For what you say in your question, I think you don't have actually pulled your local repository in your GitHub account.
To do that, use git push origin master
When you use git commit your changes are saved in your local repository, not in your remote (that in this case is GitHub)
Thanks to all that helped me understand my issue. Turns out the files did not copy between folders properly and that's why there're not changes detected on git. Now everything is working.
Thanks again!

Eclipse/Git - Pull Failed Dirty Worktree

As the title states, I'm attempting to pull from a git repository that I'm sharing between my friend and I and I can commit, he can commit, but whenever either one of us attempt to pull it brings back that it failed: DIRTY_WORKTREE
Both of us are extremely new to git, and have zero direction on how to fix this issue.
I was able to fix a similar issue by using the git command line client. While eclipse (egit) was only saying DIRTY_WORKTREE, in the command line I saw multiple conflicting files. Using git merge master from the command line, I could easily resolve the conflicts then in eclipse.
So for me this seems to be an egit issue.
Another approach, if you don't have any work in progress, is to try and reset --hard your HEAD.
With EGit: Resetting your current HEAD:
Select Team -> Reset... on a project. This opens a dialog where you can select a branch or a tag.
Reset HEAD on your current branch, in order to reset index and working tree to the last commit of said branch.
Then try your pull.
I had uncommitted changes. After I committed them, then merged, the dirty worktree issue disappeared.
Just delete the .gitignore present in the project folder, and then merge.
The merge will show conflicts , which you need to resolve and then push the changes.
It seems to mean that the version you are on now has edits that are not yet committed. So you either have to remove these edits, or commit them. Notice that if you commit them you may get merge conflicts.
This error is happening when you have made local changes to files that haven't been committed yet. In git's parlance, you have uncommitted changes in your working tree.
When you are in this situation and you try to pull, git is not sure what to do with the local changes you have. Should it discard those and pull the changes from the remote? Should it commit those before pulling the changes from the remote? That's why it fails.
To avoid this problem before you pull changes into your local repository you either have to commit your local changes, stash them, or discard them. Once you don't have pending local changes in your working tree, you should be able to pull with no errors.
In eclipse I went to Team Synchronizing View and from there right clicked on my project and hit 'overwrite' to overwrite all local changes. Then retry your merge.
Only to add another case, I've got DIRTY_WORKTREE, I'm the only one commiting to my Github project, so in EGit I did a Push branch... with "Force overwrite of branch on remote if it exists and has diverged"
DANGER: If other are working on the same project, this action will delete their commits since divergence.
I had similar problem on Eclipse with uncommited changes as ununiform.
After a commited I could merge and everything is back as it should be.
Take a look at your source code and check any changes. If none you can reset hard.
Delete the affected files and try to pull again. Thereafter push your changes to the git. I has the same issue and this worked for me.
In my case, the DIRTY_WORKTREE was caused by this sequence:
In a commit, I committed also some files that I should have ignored
In the next commit I modified the .gitignore that ignore the above files
Try to rebase on top of another branch where my change to .gitignore is missing
In this scenario, Eclipse thinks your working tree is dirty. Indeed, it is not obvious comparing two filesets when one of the two is ignoring some files and the other is not.
To solve the issue in Eclipse, I did the following:
Modify the .gitignore so it is the same as the one in the branch I want to rebase on
Happily start the rebasing or rebasing with merge.
If you have changes without commiting, eclipse will advise you if you try to pull changes. To solve it, you can discard the changes or do the commit of these files.
Source: https://www.eclipse.org/forums/index.php?t=msg&th=890477&goto=1565668&#msg_1565668
If you want to override you local branch to the origin branch.
Go to Git repo view> click on origin master> Choose reset ->it will show current HEAD and resetting to branch.
Choose HARD reset, if you want to completely overwrite your local changes
I think this problem is caused by EGit version.
When I used Spring Tools Suite with EGit 2.6, I also faced same problems.
EGit is included in STS Default package, so EGit upgrade is very difficult.
Currently I am using eclipse WTP with EGit 3.7, this problem is disappeared.

sourcetree and eclipse - can't pull from git repository

I have some problems with a git repository. The main problem is that I can't pull from it, but i am still able to push to it.
I had some problems when I wanted to import it in eclipse, but got it to work after my previous question right here .
I can pull from the git repo if I delete the repository in sourcetree and the project in eclipse and then import it again, but obviously I don't want to do that every time I wish to pull.
I really hope anyone can understand my problem and hopefully have some suggestions for a solution