AndreaFavero71 / cubotino

Updated scripts and files for CUBOTino autonomous: A small, 3D printed, Rubik’s cube solver robot
Creative Commons Attribution 4.0 International
47 stars 16 forks source link

I made a mess: repo's history overwritten #14

Open AndreaFavero71 opened 7 months ago

AndreaFavero71 commented 7 months ago

I'm raising this isse to let you know that, by mistake, I have overwritten the repo's history (commits) up to 26/01/2024. I'm not a git expert, yet it's clear to me I have mess up things....

In case you'll pull for updates an error messase will be returned

pi@cubotino:~/cubotino/src $ git pull
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
remote: Enumerating objects: N, done.
remote: Total N (delta 0), reused 0 (delta 0), pack-reused N
Unpacking objects: 100% (N/N), ZZZ bytes | ZZZ KiB/s, done.
From https://github.com/AndreaFavero71/cubotino
 + XXXXXX...YYYYYY main       -> origin/main  (forced update)
fatal: refusing to merge unrelated histories
pi@cubotino:~/cubotino/src $ 

To get the update, it's necessary to "git reset --hard origin/main":

pi@cubotino:~/cubotino/src $ git reset --hard origin/main
HEAD is now at XXXXXX "commit description"

Your local repository is now up to date: If you run "git status" the differences will only be on your local .txt files. However, your local history remains "divergent" from the remote one (my fault): if you run "git pull", the error message will continue to appear. This requires to "git reset --hard origin/main" every time you'll update your local repository.