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
-
kevbost25618yYou can `git checkout commit` to spend time with a previous push. Is that not what you're looking for?
-
coookie26128y@rookiemaverick I actually want to switch between versions of my code. Let's say a function, I can't ctrl+z all the way till it's back. Soo, staging and resetting don't seem to be helping much, or maybe I am failing to see.
-
kevbost25618y@coookie If you're worried about messing up the git history, git branch and push to the new branch. Then you can switch to whatever version you want without fear of mucking anything up
-
coookie26128y@kevbost True, and that's a perfect solution which I followed initially. And for the weirdest reason I can't do that, there's a slackbot which posts these messages on the company public channel, and I really wouldn't want my test commits ending up there
-
kevbost25618y@coookie That makes so much sense now. I definitely understand being weirded out by that.
-
mathio78yCreate git branch for development. Commit as often as needed - you switch between commits. One you are done, squash (rebase) all your commits and merge to master.
-
You can create a branch that only stays on your computer, then just merge that whenever you're ready.
There's also git stash, although that may not be appropriate here. -
For the branch thing, just create a new branch normally (git checkout - b new_branch_name) which creates a new branch based off of the current branch, and then switches to that branch. When you're done, you just switch back to the main branch (git checkout main_branch_name) and then merge it (git merge new_branch_name). Although that will include all the commits you've made in the other branch, and I don't have much experience with squashing commits in git
Related Rants
!rant
Often times while working/debugging I get to a state where the app/whatever works but then I realize that it didn't, so some more changes and I get to a new state.
Question is, does there exist something which lets me switch between these states without messing up my git? I do have a solution in mind but want to know if it already exists.
undefined
git workflow
question