I don't know if this post was intended as humour or a way to vent out some frustration but in my experience, this path of treating git as "spell X solves problem Y" will always break down. Version control systems are an important part of the programmers toolkit and it's worth investing a little time to get the fundamentals right. Sure git is not the friendliest of beasts but what it lacks in interface, it more than m…
Some bad Git situations and how I got myself out of them
21–30 of 352 posts
Re: Some bad Git situations and how I got myself out of them
#22> Oh shit, I accidentally committed to the wrong branch! Other ways to do it (that don't require to retype the commit message): - rebase onto the correct branch: git branch foo git reset --hard HEAD~ git rebase --onto name-of-the-correct-branch HEAD foo git checkout name-of-the-correct-branch git merge foo git branch -D foo - cherry-pick git reset --hard HEAD~ git checkout name-of-the-correct-branch git cherry-pick n…
git branch name-of-the-correct-branch
git reset --hard HEAD~
git checkout name-of-the-correct-branchRe: Some bad Git situations and how I got myself out of them
#23I don't know if this post was intended as humour or a way to vent out some frustration but in my experience, this path of treating git as "spell X solves problem Y" will always break down. Version control systems are an important part of the programmers toolkit and it's worth investing a little time to get the fundamentals right. Sure git is not the friendliest of beasts but what it lacks in interface, it more than m…
i agree, if you really want to be more productive (and without having to go find some git expert on your team) knowing how each operation works and why its doing what its doing is really beneficial.
despite that, its sometimes frustrating due to inconsistencies in the git "grammar" that i sometimes don't understand, like why if you want to apply only one file from git stash you have to use `git checkout` rather than `git stash apply [] -- `. it makes "sense" but is unintuitive when i'm thinking about using stashed commits.
Re: Some bad Git situations and how I got myself out of them
#24I don't know if this post was intended as humour or a way to vent out some frustration but in my experience, this path of treating git as "spell X solves problem Y" will always break down. Version control systems are an important part of the programmers toolkit and it's worth investing a little time to get the fundamentals right. Sure git is not the friendliest of beasts but what it lacks in interface, it more than m…
it was really hard for me to understand vim until a website explained it as being a set of grammars you can learn. i agree, if you really want to be more productive (and without having to go find some git expert on your team) knowing how each operation works and why its doing what its doing is really beneficial. despite that, its sometimes frustrating due to inconsistencies in the git "grammar" that i sometimes don't…
Re: Some bad Git situations and how I got myself out of them
#25 git checkout otherbranch
git checkout firstbranch -- fileIwant maybe1more
git commit -m "brought over files"Re: Some bad Git situations and how I got myself out of them
#26Like cherry picking, force pushing, merge --no-commit, rebasing... almost any operation can end up going wrong.
Just pay attention.
Re: Some bad Git situations and how I got myself out of them
#27I managed to "rm -rf .git" at one point. Took me about a minute to realize and -surprisingly after -ing i lost nothing (as far as i was aware). Git is freaking hard to break. Also always remember git-reflog, it safes lives.
Re: Some bad Git situations and how I got myself out of them
#28'sudo rmdir'? I don't think that does what they think it does.
Re: Some bad Git situations and how I got myself out of them
#29Re: Some bad Git situations and how I got myself out of them
#30Earlier quoted context omitted.
it was really hard for me to understand vim until a website explained it as being a set of grammars you can learn. i agree, if you really want to be more productive (and without having to go find some git expert on your team) knowing how each operation works and why its doing what its doing is really beneficial. despite that, its sometimes frustrating due to inconsistencies in the git "grammar" that i sometimes don't…
The absolutely easiest way to learn vim is to just schedule a reminder every ... month? week? to run "vimtutor". Then do that for a few minutes until you get frustrated or want to do something else. It's shocking how fast you'll learn.