I am pretty new in GIT and I have the following doubt about the correct use of the git diff --staged that should compare the staging area content with the last commit.
So I obtain this output:
$ git diff --staged
diff --git a/game.js b/game.js
index 49bf5ea..0783175 100644
--- a/game.js
+++ b/game.js
@@ -421,6 +421,7 @@ Ship = function () {
}
if (KEY_STATUS.space) {
if (this.delayBeforeBullet <= 0) {
+ this.delayBeforeBullet = 10;
// added to fix the bug !!!
for (var i = 0; i < this.bullets.length; i++) {
if (!this.bullets[i].visible) {
SFX.laser();
@@ -539,6 +540,7 @@ BigAlien = function () {
this.delayBeforeBullet -= delta;
if (this.delayBeforeBullet <= 0) {
+ //if (this.delayBeforeBullet = 10) {
this.delayBeforeBullet = 22;
for (var i = 0; i < this.bullets.length; i++) {
if (!this.bullets[i].visible) {
Andrea@Andrea-PC MINGW64 ~/Documents/WS_vari/version-control/asteroids ((3884eab
...))
So what exactly means this output? I think that it means that, in the staging area I have add these 2 lines:
1)
+ this.delayBeforeBullet = 10; // added to fix the bug !!!
2)
+ //if (this.delayBeforeBullet = 10) {
that I don't have in the last commit.
Is it my reasoning correct?
Yes, but it's more accurate to say that in the staging-area, you have a version of the file that has those two extra lines.
The staging-area contains complete files, not just differences from other files. It has complete copies of other files as well; they're just identical to the versions of the files in the HEAD
commit, so git diff
doesn't show them.