How to undo the sync to get the files in local repo back? - github

I'm very new to github and I started using it a few weeks ago for my uni group project.
The problem that I'm having is:
There is a remote repo on github where everyone in the group is using.
I do have a local repo on my laptop, where I've worked my part of the project.
I recently committed and synced the updates that I made to github using desktop app for mac.
I got a few errors and the sync failed.
After that when I looked at the files that I have locally, they got overwritten by the ones from the git(non-updated version) and all of my work are gone.
Can you please help me on what I should do to receive the files that I had locally? Is there any way that I can undo that last sync. I found a few suggestions online, but since I'm not sure which one to use, I don't really want to mess up the files anymore.
Thanks

(Nearly) All changes made to git repositories can be undo. We don't know the commands you entered but enter it at Google for a specific solution.
You proberly have to use something like:
$git rebase

Related

How do I get my Git commits to show on github?

I am new to this world and enrolled in a bootcamp. We created a GitHub account a few months ago. At the time everything worked fine. I was able to make changes locally and commit them via the command line, fork repos, clone them, make changes, and commit. All the good stuff.
Now after not using GitHub for much recently we are back working on a project there. However, now whenever I make a commmit it is not tracking on GitHub. When I make the change, add it and commit it I receive the below message and no changes show on GitHub.
1 file changed, 1 insertion(+), 1 deletion(-)
I am not sure what has happened. Is it possible I have moved the files to the wrong directory? At this point I am not sure how to tell what directory I need to have the files in. Any insights would be much appreciated.
You need to git push to send your local changes to GitHub.
https://training.github.com/downloads/github-git-cheat-sheet/

Safe way to rename GitHub repository to the name of one I just deleted?

I had 2 repos on Github: "RepoName" and "RepoName_old". I thought I was going to rebuild my project but changed my mind and have been improving "RepoName_old" ever since. I deleted "RepoName".
If I rename "RepoName_old" to "RepoName" (the deleted repository), will something go horribly wrong? The official documentation warns against trying to pull from a branch associated with the old name...I guess that's a different thing...will GitHub Desktop acknowledge the new name after I make the change?
I have terrible experience mismanaging my git repositories and I want to avoid another setback by being informed and careful.
GitHub Desktop is a local tool which should reflect the changes done on GitHub.
On GitHub side, if you have deleted RemoName, you should be able to rename "RepoName_old" to RepoName.
Check first that it works on github.com.
Then try and clone it in command line, and, with GitHub Desktop, add it from your local folder. That should force GitHub Desktop to recognize RepoName with its new origin URL.

Blogdown - window to stage and commit changes no longer appears

I recently created a website using blogdown and now hosting it on a GitHub repository and netlify to deploy. When I set it up, I followed the directions to clone my GitHub repository to be able to commit files using the git version control. So making changes within Rmarkdown and then committing them to my GitHub repository was easy.
However, when I connect to the project now, the window where I can commit changes does not appear. That is, I no longer have the option to commit changes within R studio. My guess is that the connection between the terminal and GitHub was changed/removed? Does anyone know how to re-establish this? I've looked up the syntax to use in the terminal, but I couldn't find a similar problem - that is, re-establish the connection between my GitHub with an already existing project already on my desktop.
Posting an answer to this question in the case others have a problem. It was an issue with MojaveOS. You have to re-install command line tools in the terminal.
xcode-select --install
Doing this, the version control now works to commit files to my github repository.

Github on multiple computers

I just started using github more seriously, and have a question,
most of the time I am working from my laptop however sometimes I work from my mac,
if I download the the git desktop app on the mac and clone the repo will I still have full access and if i update something will it update on laptop
thanks
You'll still have full access, but you'll need to do a git pull after you commit on one machine in order to sync with the work you've done on the other. It won't be automatic.

GitHub client cannot sync after changes made to some files

I have a git repository in which I work in collaboration with some people but I cannot sync anymore. I am using the GitHub Windows client application on Windows 7:
Last time I synced, the operation succeeded and I ended up with a perfect copy of the latest code.
Next, I made some simple changes to a few files, but did not commit anything yet.
In the meantime, someone else made changes to some other files.
In order to see the changes of the repository, I'm trying to sync again.
GitHub client reports "Sync failed".
Now I am wondering if this is normal behavior or if there is something wrong with my repository ? Shouldn't I be able to sync the repository and get latest files even though I am making some changes that are still not committed ?
Thanks.
When you got this kind of error just try to open a git shell and type git status into your working directory. You will have some infos that could help you like which files are in conflict.
It must be one of the other collaborators that updated and pushed a file you just updated. If so, you will have to choose which version you want to keep in your local files.