Gitlet.js – Git implemented in 1k lines of JavaScript (2015)
21–30 of 78 posts
Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)
#22In the 'real' Git, one of the functions I use frequently is `git checkout -- .`, which discards any unstaged changes. Looking at Gitlet's implementation, it wouldn't handle that well as `checkout` can only take a ref. So I guess I'm wondering what the real `git checkout -- .` actually does behind the scenes?
FWIW, since Git 2.23 I prefer using "git switch" and "git restore" instead of "git checkout".
Not only is it more semantic, it reduces the complexity of ‘git checkout’ which is a common complaint.
Really, It doesn’t make much sense to tack on some random ’--‘ flag on ‘checkout’ for that functionality. ‘restore’ is clear and describes what it does.
Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)
#23this is cool! but I'm curious to see a git blame implementation.
You mean the most conflict driven and passive aggressive feature in any programming tooling?
Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)
#24this is cool! but I'm curious to see a git blame implementation.
You mean the most conflict driven and passive aggressive feature in any programming tooling?
In a political organization, it's good to take responsibility for something, but bad to blame. A generous interpretation of that is that the person/group who made the decision should raise their own hand, and that it's a faux pas for others to point them out.
In a healthy one, you can recognize it's the same thing, and the important thing is how you respond to it (i.e., it's important to understand the responsible party so you can understand the reasons/motivations for the action, and accept them or address them).
Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)
#25If you're curious: https://inst.eecs.berkeley.edu/~cs61b/sp20/materials/proj/pr...
Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)
#26In the 'real' Git, one of the functions I use frequently is `git checkout -- .`, which discards any unstaged changes. Looking at Gitlet's implementation, it wouldn't handle that well as `checkout` can only take a ref. So I guess I'm wondering what the real `git checkout -- .` actually does behind the scenes?
FWIW, since Git 2.23 I prefer using "git switch" and "git restore" instead of "git checkout".
Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)
#27We have a project at UC Berkeley for CS 61B (undergrad data structures) called "Gitlet", where we need to make a git implementation in Java. Was super fun! If you're curious: https://inst.eecs.berkeley.edu/~cs61b/sp20/materials/proj/pr...
Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)
#28In the 'real' Git, one of the functions I use frequently is `git checkout -- .`, which discards any unstaged changes. Looking at Gitlet's implementation, it wouldn't handle that well as `checkout` can only take a ref. So I guess I'm wondering what the real `git checkout -- .` actually does behind the scenes?
Honestly it had never even occurred to me to use the period there, but it does work :) I always used it for single files.
As we said in other comments, that’s why they introduced ‘restore’.
But, if you’re looking to reset all changes, in every file back to the state of the HEAD, then I believe ’git reset —hard’ would be the appropriate tool!
Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)
#29We have a project at UC Berkeley for CS 61B (undergrad data structures) called "Gitlet", where we need to make a git implementation in Java. Was super fun! If you're curious: https://inst.eecs.berkeley.edu/~cs61b/sp20/materials/proj/pr...
Ah, Hilfingr memories.