Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
asgs112754yYes, it is horrible and terrible. The Git book explains it in detail -
https://git-scm.com/book/en/...
Though it looks too long to read, I believe the first half of article should be present in the basics section before teaching what git commands mean and do
But I learnt my lesson long ago to not keep huge chunks of changes in the working directory. Frequent commits (and pushes, of course) and small commits make the developer life a lot more manageable and disaster-recoveryable -
donuts236724yCan someone translate to non git terms?
Dunno what the diff is btwn reset n checkout...
I use GitExtensions... Just commit, pull, push, checkout and usually always at the HEAD of whatever branch im in. -
@donuts in Git you have working and staging area. When you want to push something to the repository, you put the changes in the staging area before committing and pushing it to the repository. You use `reset` to remove something from the staging area, so, you don't want to commit this yet. You use checkout when you don't want the changes, so, it gets back to the version committed. Also, I'm not trying to be extensive here, but it's basically it.
-
donuts236724y@asgs finally read that page. Good recommendation except it didn't seem to work like that when I tried reset last week.
Somehow after a commit the whole local branch messed up... Said a whole bunch of files were now changed... But didn't.
Remote was fine though...
I tried reset --hard but it didn't do anything.
Then tried reverting all the "changes" and then manually downloaded and extracted the remote files over the working dir...
Which somehow added all the changes back.
Finally, Reverted again then switched to the main branch, did a pull then deleted the other branch and checked it out from remote.
This worked but isn't this was reset --hard was supposed to do and well how come overwriting didn't work either? -
donuts236724yOnly thing I can think of is the the Working dir tree got moved to like v1 somehow?
How do you check and move it back to the latest? Without basically doing a format and reinstall? -
donuts236724y@asgs but I can't understand after I commit and push, how did the local get out of sync.
Read online at the time something about a local cache but didn't really get it. And I think it said reset --hard would fix it.. Except it didn't. -
asgs112754y@donuts if you can share the exact history of commands, we could understand the situation better. Paraphrasing doesn't really help
Sometimes your day is going really nice, and you just had a nice cup of tea with the milk from the best cow on the farm. You're coding happy, and you will take a walk after that. Then, suddenly, you type `git checkout .` rather than `git reset HEAD .` and your life is miserable now.
rant