5 ms·
Exactly! Also imagine the situation when you only were working inside one source folder in a large code base, changed 3-4 files significantly and latter decided
by fayyazkl 13y ago
Exactly! Also imagine the situation when you only were working inside one source folder in a large code base, changed 3-4 files significantly and latter decided to revert back to original ones. It just takes svn revert -r revision in that folder to get back original files. With git you can't get away without having to create subtree first
- johnchristopher 13y agoWouldn't `git reset --hard <sha-commit>` do that ?
- fayyazkl 13y agoNot an option if the rest of code base is likely different from the original cloned from. For me, this very often has been the case i.e. small changes in like may be 20 files scattered all over the code base just to get my copy run in a specific way debugging an issue.
- jakub_g 13y agoWhat's wrong about `git revert <commit-sha>`? It should be just fine, supposing no one changed the mentioned files in the meantime.
- fayyazkl 13y agoOh, i meant the other 20 files all around the code base have just been changed to get my local setup to work. There is no way (without sub branching) in git to have a lot of modified files, but only wanting to revert the ones actually being worked upon. Core concept was still shallow check out in case of svn
- jakub_g 13y agoStill not sure what's the case exactly. You mean, kind of partially revert a commit, but only the files in the commit which are in a specific subfolder?
- fayyazkl 13y agoYeah Exactly. Probably i should have worded more appropriately. But given the fact that most of software developers have to maintain large existing code bases, tailor a specific subsection to achieve a goal and only need to commit just a folder in that sub section
- X-Istence 13y agogit checkout -- <file> This will revert the file back to the the last checked out version. git checkout <sha-1> -- <file> Will revert a file to the state it was in, in that particular sha-1.
- fayyazkl 13y agoYeah this will definitely do that. Only that mentioning name per file is painful. In large source trees, you often exactly don't know which files have been modified. You just have been following through a debug path making changes where needed. Just having the ability to checkout a folder down the hierarchy is really handy. Git recently added "sparse checkouts" but still they only solve the problem partially
- tracker1 13y agoWhat's wrong with making a local branch? Or remote for that reason... that's precisely what they're there for.
- fayyazkl 13y agoNothing wrong, just the fact that you cannot latter push ONLY a sub section of code from local branch (while leaving many other changes done in local for local needs) as opposed to svn. This is further mentioned in other comments
- ptx 13y agoMercurial can do that as well, with "hg revert -r <revision> <directory>".
- fayyazkl 13y agoI must admit i liked mercurial a lot. The simplicity that is underrated (of svn) is found in tons in mercurial. In fact dvcs initially was hard to get my head around conceptually with git. Keep in mind the unlearn part is harder from years of svn. Then i actually read a tutorial on Joel Spolksky's website about mercurial and how FogCreek uses it. That really helped me conceptually with dvcs.