|
|
|
|
|
by nextlevelwizard
494 days ago
|
|
Knowing how to make a branch is very basics of using git. If you don’t know how to do it (git checkout -b, btw) you are just outing yourself as someone who doesn’t use git or your just push to master i.e. you are only working on solo projects. You can switch branch also with ‘git checkout’ and you just ‘git stash’ your changes. ‘git reset’ is fine to reset files, but again if you just want to ”clean” repo you can stash. You can reset staged files again with ‘git reset’ Mo idea why you would want to checkout a random commit and the start committing from that, but you can also just ‘git reset --hard HEAD~x’ where ‘x’ is number of commits you want to go back. Hard is optional, but I assume that is what you want based on your comment. Depends on the change. If you change different lines there will be no conflicts. This is all basic stuff you should know if you are developing code with other people |
|
You can reset staged files again with ‘git reset’
To "revert a file to what was staged" you have to "git checkout" again, it seems, not "reset".
This is all basic stuff you should know if you are developing code with other people
Yeah. It seems that it is basic, until you try using it for something that is not quick one-shot patching of "append-only" code.