----BEGIN CLASS---- [13:29] #startclass [13:29] Roll Call [13:29] Shiva Saxena [13:29] Sehenaz Parvin [13:29] Muhammad Zeeshan Qazi [13:29] Naman Sharma [13:29] Kumar Vipin Yadav [13:29] tabrez khan [13:29] Aditya Patil [13:29] Vivek Shukla [13:29] Anu Kumari Gupta [13:29] Priyanka Sharma [13:29] Priyanka Saggu [13:30] Saptak Sengupta [13:30] pooja sulakhe [13:30] Manank Patni [13:30] Kuntal Majumder [13:30] Kazi Mehbbob Zaman [13:30] Rohan Vivek [13:30] Pawan [13:30] Jitendra Kumar Tripathi [13:30] Pooja kumari singh [13:30] Sandeep Kumar Choudhary [13:30] Ved_Sinha [13:30] Jagannathan Tiruvallur Eachambadi [13:30] Avik Mukherjee [13:30] Shruti Dash [13:30] Shashank Kumar [13:30] thebigj: hello [13:30] Prabhu Sharan Singh [13:30] Gajendra Saraswat [13:30] Prashant Sharma [13:30] Shivam Bansal [13:30] Akshay Gaikwad [13:30] Rakshit Airani [13:31] Vaibhav Tripathi [13:31] Bhavin Gandhi [13:31] Ananyo Maiti [13:31] priyam das [13:31] Aditya Deshpande [13:31] Sahil [13:32] Ola Ajayi [13:32] Piyush Aggarwal [13:32] Pradhvan Bisht [13:32] Shubham Sharma [13:32] Neeraj Kumar Arya [13:33] Sayani Bhattacharjee [13:33] O' [13:33] I'll wait for another 2 mins for folks to join in [13:33] Rajat Gupta [13:34] Till then I will set some ground rules for the session [13:34] Vishal Kushwaha [13:34] Nobody asks question until I've asked [13:34] I will write a few lines, then after I will ask if you have questions [13:35] then you can go ahead and ask questions [13:35] Mayank Singhal [13:36] Ratan Kulshreshtha [13:36] Abhay SIngh [13:36] #questions off [13:37] So, I am starting off with the session of Git [13:37] git ??? not tor ? [13:37] *- One fine day, you plan to start a project of yours. [13:37] *- But maintaining and building a project is nevertheless a daunting task [13:37] *- You dream that your project would be a big & successful project. [13:38] *- A community of people are be using your project. [13:38] *- But, you are just a developer and at the end of the day a human. [13:38] *- You are ought to make mistakes, forget corner cases, make bunch of typos. [13:38] *- and all the other issues that you never even thought of. [13:38] *- But, that's when the community comes to rescue. They start filing up issues. [13:38] *- You solve them one by one. But. slowly, slowly, slowly. [13:39] *- Your issues counter has reached 1000. [13:39] *- Would you be celebrating this milestone? If I were you. I would be tensed. [13:39] * end of prologue * [13:39] Roll call:karan pratap [13:39] everything good till now? [13:39] sayan, yes [13:39] Yes [13:39] Yes [13:39] yea [13:39] yes [13:39] Yes [13:39] yes [13:39] Yes [13:39] yes [13:39] yes [13:39] yep [13:39] yes [13:39] yes [13:39] +1 [13:39] yes [13:39] yes [13:40] Yes [13:40] Yes, sayan [13:40] No [13:40] yes [13:40] yes [13:40] sayan: yup [13:40] yup [13:40] What he asked ? [13:40] yes. [13:40] yes [13:40] yes [13:40] great, then moving ahead ignoring saptaks [13:40] Rollcall:Siddharth Sahoo. [13:41] rolcall:farhan_shaikh [13:41] yes [13:41] yes [13:41] *- There so much work years to spend just to fix those pending issues. [13:41] Yes [13:41] *- You wished you had a helping hand and the community who were just filing the issues [13:41] *- with comments "How can we help?" could just come and help you out. [13:41] Rollcall:nupur kapur [13:42] *- And with a tensed mind, you mistakenly forcefully delete an important chunk of code. [13:42] *- *And your nightmare dream sequence breaks* [13:42] *- Sweating profusely, You thank your god for the blessing in disguise. [13:42] *- You take an oath for each of your project you will be using a Version Control System a.k.a VCS [13:42] Sourabh Pruhti [13:42] sayan sorry for being late [13:42] *- And from here the journey of using the VCS starts for you [13:43] *- *Chapter 1: Understanding VCS: Commits* [13:43] *- Next day morning you start reading VCS, scratching your head to get around with all the terms [13:43] *- The first one that you hit is commits, so what is commit (or snapshot?) [13:43] *- So you thought of writing a series analogy stories to learn the concepts better :) [13:43] *- You create a new character, Tux [13:43] *- Tux wants to be photographer, who has just bought a new DSLR. [13:44] *- Tux plans to be the next travel photographer, who would take the best picture from the top of Mt. Everest [13:44] *- But Tux is a newbie, so Tux starts watching for YouTube tutorials for learning to post process the images. [13:44] *- Tux creates a directory named *working* to put all un-processed images. <<-- mind *working* is to be focused here [13:44] *- Then, fires up DarkTable to process the images. [13:45] *- Every time after a set of similar operations (like crop & rotate, shadows & highlights, etc), Tux creates a copy of the *working* directory and names it `snapshot-{n}` [13:45] *- After a couple of operations, Tux stands having "snapshot-1", "snapshot-2", "snapshot-3", .... , "snapshot-100" directories [13:45] *- This directories is history of how Tux developed the image over time. At any point, Tux can go back to a given snapshot and build again on top of it [13:46] Any questions till here? [13:46] Nope! [13:46] sayan, no [13:46] ! [13:46] No sayan [13:46] no [13:46] sayan, no [13:46] nope [13:46] No [13:46] no [13:46] NO [13:46] ! [13:46] no [13:46] ! [13:46] no [13:47] sayan What does post process means ? [13:47] #questions on [13:47] No [13:47] next [13:47] ! [13:47] next [13:47] ! [13:47] Tux creates a directory everytime with an update (a small update). Wouldn't it occupy a lot of space? [13:48] prabhu: Yes, it does. But keep in mind this is a analogy story to explain Git [13:48] next [13:48] I didn't understand the part about snapshot(n). What's the difference between snapshot{1}, snapshot{2} and so on? [13:49] so Tux clicked an image, after that he start post-processing that is "increasing brightness, changing colors" etc [13:49] after each operation Tux creates a new directory [13:50] so maybe snapshot{1} contains image with increasing brightness [13:50] ! [13:50] and then snapshot{2} contains changing colors [13:50] next [13:51] I think I will pass [13:51] cool [13:51] anymore questions? [13:51] It is specific to Git [13:51] ananyo: sure, ask in when I am doing the hands-on [13:51] going ahead then [13:52] *- *Chapter 2: Understanding VCS: Staging Area* [13:52] Will ask at the end of session but related to your snapshot example [13:52] *- It's been a month now, Tux have learned a lot on post-processing images. [13:52] *- Tux now mixes and matches multiple images file to create a snapshot directory. [13:52] *- One day, Tux while processing the images, goes into experimental mode. [13:53] *- and only after a while realized that the changes should be going into two [13:53] *- different snapshot directories (`snapshot-139` & `snapshot-140`). [13:53] *- Smart Tux quickly thought of an idea, creates a new staging directory. [13:53] *- A staging directory works as an intermediate between the working directory [13:53] *- and the snapshot directory. [13:53] *- So, Tux now works on working directory, and one Tux is happy with the changes [13:53] *- Tux moves all changed files into staging directory, and then creates a copy of the staging directory as new snapshot directory [13:54] any questions till here? [13:54] sayan, no [13:54] no [13:54] N [13:54] no [13:54] No [13:54] no [13:54] nope [13:54] No [13:54] no [13:54] no [13:54] no [13:54] no [13:54] no [13:54] no [13:55] ! [13:55] no [13:55] next [13:55] why should changes be oing into two different directories? [13:56] Tux is suppose working on 3 different files [13:56] and wants just to create snapshot directory of 2 files [13:56] no [13:57] copying the working directory to snapshot will copy all 3 file changes [13:57] so he got this idea to create this intermediate directory where he copies this two files and names the directory staging [13:57] and then copies staging to snapshot [13:58] any questions? [13:58] ! [13:58] if not, fire up the terminals [13:58] next [13:58] Tell me when done [13:58] sayan, so he will send the two files to the staging directory. So he won't work on them anymore? [13:58] sayan, done [13:59] done [13:59] I hope you all have git installed [13:59] done [13:59] done [13:59] yes sayan [13:59] prabhu: he copies those two file to staging, not move [13:59] yes [13:59] sayan, he doesn't send the third file as he still wants to work on that? [13:59] yes [14:00] Done [14:00] prabhu: yes [14:00] sayan, got it. thanks [14:00] sayan, yes, git installation done [14:01] *- People who do not have their username and email setup done [14:01] *- Do this git config --global user.name "" [14:01] *- git config --global user.email "" [14:01] for example, for me it would be [14:01] git config --global user.name "Sayan Chowdhury" [14:01] git config --global user.email "gmail@yudocaa.in" [14:02] done? [14:02] yes [14:02] Yes [14:02] yes [14:02] Yes [14:02] yes [14:02] Yes [14:02] yup [14:02] yep [14:02] next lets go ahead and create a directory [14:03] for this session [14:03] yes [14:03] mkdir hellouniverse [14:03] yes [14:04] sayan, done [14:04] done [14:04] yes [14:04] Done [14:04] ! [14:04] done [14:04] done [14:04] done [14:04] done [14:04] *- cd hellouniverse [14:04] done [14:04] sayan, done [14:04] done [14:04] Done [14:05] done [14:05] sayan, done [14:05] done [14:05] Done [14:05] done [14:05] *- vim helloworld.txt [14:06] sayan, done [14:06] done [14:06] done [14:06] done [14:06] *- Remember I am adding *- at the beginning so that it's easier for people to distinguish the messages that are from me [14:06] *- simply save & exit the file [14:06] Ok sanyan [14:06] sayan, thanks for doing it. It's a great strategy to even to read the logs later. [14:06] done [14:07] *- using :wq [14:07] sayan, done [14:07] Done [14:07] ::wq::done [14:07] *- now try the command git status [14:08] *- you will see an error [14:08] *- right? [14:08] not a git repo [14:08] gityes [14:08] sayan, Do we need to write something on the txt file. Then use :wq ? [14:08] yes [14:08] not a git repo [14:08] siddharth: no, just a blank file [14:08] :wq [14:08] *- yes, so the current directory is not a git repo yet. so it gave a fatal error [14:08] sayan, right [14:08] sayan, we didn't do git init [14:08] not a git repo [14:09] *- so to make it a git repo we do git init [14:09] v16k_, please don't introduce some commands which are yet to be told. [14:09] sayan, done [14:09] *- now if you do git status [14:09] prabhu, ok [14:10] sayan, untracked files [14:10] untracked files [14:10] *- you will see the file helloworld.txt under untracked files [14:10] sayan, yes [14:10] *- which means Git is not tracking this files right now [14:10] yes [14:10] *- there could be many files under this section [14:10] ! [14:10] *- for now we just have one [14:10] yes [14:11] *- But any changes to these file wont be tracked by Git [14:11] next [14:11] sayan, what do you mean by tracking? [14:11] i was just asking for the error while configuring [14:11] viviy [14:11] git config --global "Sarques" [14:11] error: key does not contain a section: Sarques [14:11] sorry [14:11] sayan ^ [14:12] Sarques, you forgot user.name [14:12] Sarques: did you read the lines correctly? [14:12] Sarques: you forgot something [14:13] okay sorry, i thought "name" if for placing at user.name [14:13] thanks ,eom> [14:13] Sarques: cool, np [14:15] *- So, git has various configurations [14:15] *- And you can set them via the terminal [14:15] *- this can be set using the git config sub command [14:16] ! [14:16] *- user.name and user.email are two keys for which you are setting the value [14:16] *- So when I do git config --global user.name "Sayan Chowdhury" [14:16] *- Sayan Chowdhury is the value set for user.name globally [14:17] next [14:17] pass [14:17] next [14:17] sayan To use git do we need a internet connection or it works off-line too ? [14:17] ! [14:18] siddharth: there are VCS which require you to be online, but git works offline [14:18] next [14:18] sayan, Git and GIthub ? Both are the same or different ? [14:18] ! [14:19] next [14:19] It is untrack because it is in working dir? [14:19] github is a frontend to implement git [14:19] git is the actual VCS [14:19] ! [14:19] git or svn or whatever [14:19] shadowroot: please don't answer out of turn questions [14:19] How is mirroring achieved in ot? [14:19] *tor [14:20] prokbird: no, you will understand what is working directory is later [14:20] prokbird: I'll get to it [14:20] Souvik: this is not the Tor session [14:20] sayan, ok [14:20] sayan: anyone can answer yea ? [14:20] shadowroot: anyone can anwer but siddharth asked out of turn [14:21] ohh sry [14:21] When is the tor session? [14:21] i didn't know that [14:21] sorry* [14:21] next [14:21] sayan, I don't know whether it will be explained later. So, what is the difference between "global", "system" and "local" config file? [14:21] shadowroot: read the rules. You have been breaking them everytime you show up [14:22] sayan, I was on my turn.Check it once again.You didn't let me ask completely.I didn't added any . [14:22] siddharth: You don't ask multiple questions all at once [14:22] sayan, Then what the importance of ? [14:22] prabhu: no, I will not explain that in this session. but after the session I can [14:23] sayan, okay [14:23] ! [14:23] sayan, I found it using git config and got curious. [14:24] sayan, If you saying I did a mistake. I am apologetic and it won't happen again. [14:24] siddharth: means that the questions you asked has been cleared [14:24] nex [14:24] next [14:24] When is Tor session? [14:24] Souvik: read the email [14:24] sayan, That's what I am saying I was not clear then. [14:24] moving ahead [14:25] siddharth: if you have two very unrelated questions, you raise hand twice [14:25] that does not mean I press ! in two quick succession [14:25] sayan, Okay. [14:25] the aim is that everybody gets a chance [14:25] moving ahead [14:26] *- so to make git track your files you use the command git add [14:26] *- do git add helloworld.txt [14:26] sayan, It won't happen again.I understood the rules.Let's continue the session. [14:26] *- now do git status [14:26] ! [14:27] sayan, warning when doing git add [14:27] sayan, hello.txt Changes to be committed [14:27] changes to be commited [14:27] prabhu: What warning? [14:27] commited, new file: helloworld.txt [14:27] sayan, LF will be replaced by CRLF. What is this about? [14:28] sayan, I meant a warning is showing by git [14:28] showing/shown* [14:28] prabhu: I am skipping that [14:28] prabhu: don't use windows is the short answer [14:28] prabhu: because that's out of the scope of Git class today [14:28] prabhu: I think you are in windows system. [14:29] j605: +! [14:29] +! [14:29] saptaks, yes [14:29] saptaks, yes [14:29] prabhu: we told you to use Linux, your choice :) [14:29] prabhu kps_ maybe can talk after session about this. [14:29] sayan: sorry to interrupt. [14:29] sayan, I have intalled it today. I need to set it up completely before starting developing on it :) [14:30] *- When you git add a untracked file. It directly goes to staging [14:30] sayan, even if I am using windows, the warning is valid and I need to know the reason. [14:31] *- that's why you are seeing the text "Changes to be commited" [14:31] *- that means, all the changes in this section goes into the commit [14:31] *- we will see more in detail later [14:31] ! [14:33] prabhu, refer to this : https://stackoverflow.com/questions/17628305/windows-git-warning-lf-will-be-replaced-by-crlf-is-that-warning-tail-backwar/17628353 [14:33] *- kushal told me that we did not have a vim class, so I will refrain from using vim now [14:33] *- let's use a editor of your choice, if possible gedit [14:33] sayan, we have asked people to read LYM and we have basics there. [14:34] I see it has a vim chapter, sorry! [14:34] sayan, yes we have read basics of vim in LYM's book. [14:34] okay we are free to use vim then [14:34] *- vim helloworld.txt [14:34] yes we are ok with vim [14:35] *- Write the text "Snapshot 1" inside the file [14:35] next [14:35] ! [14:35] sayan, done [14:36] done [14:36] next [14:36] What is ideal way to stack the changes? what is the difference between git add . and git add -A :/ [14:36] what is branch master indicate? [14:36] prokbird: I will explain that later [14:36] ! [14:36] sayan, np [14:37] Souvik: every file seperately [14:38] sayan, should we make changes in the working directory or the staging directory? [14:38] I didn't understand. can you elaborate? [14:39] Souvik: best way is to add all the file seperately just to make sure you don't make mistake [14:39] Souvik: I use git add -u [14:40] most of the times, but if needed then I add it seperately [14:40] next [14:40] sayan, should we make changes in the working directory or the staging directory? [14:40] prabhu: why don't you wait for your turn? [14:41] prabhu: that example was a analogy, here it's the same area except you move from working area to staging area [14:41] next [14:41] *- What does git status show now? [14:42] sayan, sorry about that. won't happen again [14:42] sayan, Changes not staged for commit: modified: helloworld.txt [14:42] modified: helloworld.txt [14:42] modified helloworld.txt [14:42] modified: helloworld.txt [14:43] ! [14:43] changes not staged for commit: modified: helloworld.txt [14:43] https://pastebin.com/KmFuPt8B [14:43] Souvik: re: what is the difference between git add . and git add -A, I guess does the same thing [14:44] I don't use them but iirc they do the same thing [14:44] modified: helloworld.txt [14:44] *- now do git diff [14:44] *- You should see the lines that were added [14:45] sayan, yes [14:45] yes [14:45] Yes [14:45] yes [14:45] yes [14:45] yes [14:45] yes, +Snapshot 1 [14:45] yes [14:46] yes [14:46] yes [14:46] zyes [14:46] *- Now lets add this change again [14:46] *- using git add helloworld.txt [14:47] *- ^^ see here how I can explicitly mention which files needs to be added [14:47] sayan, done [14:47] done [14:47] *- next, git status should show again the file in the staging area [14:47] yes [14:47] any questions till here? [14:47] sayan, ys [14:48] I have a question. [14:48] ! [14:48] no [14:48] next [14:48] sayan, In continuation of your previous answer...How is this the same area? Aren't the working and staging area supposed to be different? [14:49] ! [14:49] prabhu: sorry, I meant directory, same directory except you move from working area to staging area [14:49] next [14:49] sayan, what does other information like '---', '+++' and index show in git diff ? [14:50] kvy: that is from where is it comparing [14:51] --- from-file from-file-modification-time [14:51] +++ to-file to-file-modification-time [14:51] next [14:51] sayan, ooh got it thank you [14:51] what is git diff actually doing ? also is diff stand for something (like a short form ) [14:51] vshuklajr: diff is showing the difference since the last change [14:51] vshuklajr: should me more clear as the class goes on [14:52] Now moving ahead [14:52] *- to commit, git commit -m "Snapshot 1" [14:52] done? [14:52] done [14:52] sayan, done [14:52] done [14:52] done [14:53] done [14:53] Done [14:53] done [14:53] *- once done, if you do git log, you will see the list of commits [14:53] *- it contains the message, timestamp, author information etc [14:53] sayan, yes [14:53] yes [14:53] ! [14:53] next [14:53] yes [14:53] ! [14:54] ! [14:54] yes [14:54] next [14:54] now we have commit,is it still in local dir? [14:54] next [14:54] how to copy commits from one branch to another branch? [14:54] What is -m for? [14:54] now we have commit,is it still in local dir? means inside our system [14:55] Souvik: what is branch? haven't heard of it [14:55] prokbird: yes, still local [14:56] https://git-scm.com/book/en/v1/Git-Branching-What-a-Branch-Is [14:56] sayan, thanks [14:56] sd30: After -m you specify what is the git commit message [14:56] master is a branch only [14:56] the default branch [14:56] Okay, thanks sayan [14:57] You can say, pointer to commits. [14:57] Souvik, please don't introduce things which are yet to be explained. Others may get confused. [14:57] next [14:58] ! [14:58] mext [14:58] next [14:58] Date: Wed Jul 4 20:23:21 2018 +0530 , what is +530? [14:58] Is it mandatory for everyone to be on the same level to attend this? I didn't knew that! I was just clarifying my doubts about git. [14:58] prokbird: timezone [14:58] oh [14:58] prokbird: UTC+530 == IST [14:58] Souvik: yes, you have to be one same level [14:59] \exit [14:59] s/one/on [14:59] shadowroot, thanks :) [14:59] Souvik, its /quit [14:59] *- moving ahead [14:59] Thanks. I'll join later then. [14:59] *- vim helloworld.txt [15:00] *- Add a new line "Snapshot 2" [15:00] sayan, done [15:00] done [15:00] done [15:00] done [15:00] done [15:01] done [15:01] Done [15:01] done [15:01] done [15:01] *- git status should again send the file to working area, with the changes being shown [15:01] sayan, yes [15:02] *- do a git diff and you would see the changes [15:02] ! [15:02] *- but this time you would just see the change as "Snapshot 2" which is obvious, right? [15:02] next [15:02] yes [15:02] sayan, done It's showing changes [15:02] what does cherry-picking means and actually do ? [15:02] yes [15:02] yes [15:03] yes [15:03] yes sayan [15:03] shadowroot: when you pick a lot cherries from a cherry farm it's called cherry-picking [15:03] yes [15:04] ! [15:04] next [15:04] sayan: cherry-picking in git i mean [15:04] shadowroot: point me in today's log where I wrote about cherry-picking [15:04] let me rephrase my question. What does cherry-picking a commit with git mean ? [15:05] sayan, does vim check our keystrokes as pressed enter two times and backspace a well and its showing "--" in between "Snapshot 1" and "Snapshot 2" [15:05] shadowroot, patience [15:05] kps_: sure [15:06] prabhu: fpaste your diff? [15:07] prabhu: https://paste.fedoraproject.org/ -> go here and paste the output of git diff [15:08] moving ahead [15:08] sayan, https://snag.gy/QoCmj9.jpg [15:08] *- git add helloworld.txt [15:09] sayan, done [15:09] done [15:09] prabhu: you had two empty lines at the end of the file, those were removed [15:09] *- now, you changes are in the staging directory [15:09] sayan, Okay got it, thanks [15:09] s/directory/area [15:10] *- but how do you check the diff in the staging area? [15:10] *- it is done using git diff --staged [15:10] ! [15:10] ! [15:10] ! [15:10] ! [15:10] *- so before commit it is always good to review the changes in git diff --staged [15:10] next [15:10] what exactly is a staging area? [15:11] is it some temporary memory? [15:11] So referring to your previous explanation of snapshot [15:11] ananyo: wait for the turn [15:11] I created copies of both versions of file [15:11] Oh sorru [15:11] *sorry [15:12] sidntrivedi012: When you do 'git commit' it takes everything in the staged area and bundles it into a commit. [15:12] diff in staging area goes into the commit [15:12] understood? [15:12] sayan, yes.so is it a temporary mem buffer? [15:13] there is no memory involved [15:13] ! [15:13] git stored all the information in .git directory [15:13] if you do ls -l in the current directory [15:13] sayan, so it just compares new files to old files [15:13] you will see a .git directory [15:13] where where stores all the metadata [15:14] sayan, ok.got it. [15:14] next [15:14] So referring to your previous explanation of snapshot [15:14] I created copies of both versions of file [15:14] While I was commiting [15:15] What I find is the size of the final state is the size of the directory [15:15] So does git creates a snapshot at every stage [15:16] Or does it just stores the diff ? [15:16] ananyo, everytime you commit [15:17] What happens when you commit ? Does it creates a separate snapshot in every commit or does it just store the diff ? [15:18] ananyo: it does a hash, iirc [15:18] ananyo: let's discuss this after the class [15:18] Yup it does create a commit hash [15:18] Hmm ok sure [15:20] next [15:20] why isn't git diff working in the staging area? Also, why is there a need of staging area at all? Can't we make changes and commit directly from the working directory? [15:21] prabhu: If I am working on 3 files, and just need 2 files to be commited [15:21] staging area helps to properly organize your commits into meaningful changes [15:21] next [15:21] I do not understand the difference between staging area and staging directory. [15:22] sayan, So I will commit those two files directly without adding. [15:22] sayan, What is the problem in that? [15:22] prabhu: I did not get you [15:23] sd30: I used staging directory as analogy to the tux story, here it renames to staging area [15:23] I will not use git add, and use git commit directly after making changes to those 2 files. [15:23] prabhu, think you are in a buffet and you are vegetarian(suppose)! So you only take the foods you eat in your plate and then eat them! [15:23] Okay got it sayan [15:23] prabhu, https://softwareengineering.stackexchange.com/questions/69178/what-is-the-benefit-of-gits-two-stage-commit-process-staging [15:23] and think you to be git, eating as commiting and plate as staging [15:24] prabhu, things will get cleared once you actually work in a project! [15:24] prabhu: suppose I changed the 3rd file for testing which does not need to be in the commit [15:24] sayan, sorry, spoke a lot out of turn! [15:24] for example the third file had the debugger statements in them [15:25] sayan, okay.. [15:25] ! [15:25] what I do is I just add those two files, rather than adding and removing those unwanted statements [15:25] next [15:25] sayan, So, I will not commit it. Simple as that. [15:25] what is the difference between 'git add' after doing changes in already existing file and 'git commit' [15:26] vshuklajr: you add the new changes that were introduced after the commit was done [15:27] prabhu: how? [15:27] that's not very logical [15:27] sayan, I didn't get you with the your statement. [15:28] prabhu: I have three dependent files, I made changes to 2 files to introduce a new feature [15:28] and in the third file I added a bunch of print statements to see the logs/ or how the program runs [15:29] so I move 2 files to staging and commit them, totally ignoring the third file [15:29] next [15:29] sayan, that's what I am saying, why did you moved them into the staging area? You could have directly commited them. [15:29] next [15:30] sayan, is git commit a confirmation stage before actually changing the contents of the directory?I thought it makes sense by the literal meaning of word 'commit'. [15:30] prabhu: in that case it would commit all the three files [15:30] Can't we specify the name of the files to be commited? [15:31] prabhu: here we are talking of file level, sometimes we do have to go to diff level, where we pick which diff to commit and right now it's out of scope [15:32] sidntrivedi012: git commit means the commits are now committed and saved [15:32] sayan, okay, got it, Can I DM you? [15:32] *- moving ahead [15:32] prabhu: not now, after the class publicly ask [15:32] sayan, okay [15:33] *- Next commit with the commit message "Snapshot 2" [15:34] sayan, done [15:34] done [15:34] done [15:34] sayan, done [15:34] done [15:34] *- Next create a new file hellomars.txt [15:35] sayan, done [15:35] Done [15:35] done [15:35] *- and commit it with the commit message "Add the file hellomars.txt" [15:35] tell me when done [15:35] done [15:35] done [15:36] done [15:36] sayan, done [15:36] anybody still working on it? [15:36] done [15:36] me [15:36] Done [15:37] done [15:37] Done [15:37] done [15:37] *- Now add a new line "Mars is the added planet" [15:38] *- Now another way to add the change is git add -u [15:38] *- git then adds all the changes from the tracked files to staging area [15:38] *- and then you can proceed to commit "Add a new line in hellomars.txt [15:39] questions? [15:39] No, done [15:39] done [15:39] sayan, done [15:40] ! [15:40] next [15:40] After using git add -u, its showing that helomars.txt is still untracked on git status [15:41] prabhu: did you follow as I said? [15:41] yes [15:41] sharing the screenshot in a moment [15:41] ! [15:41] I guess you missed a big part, did you do the commit Add the file hellomars.txt? [15:41] prabhu: sure [15:41] prabhu, did you do git add for hellomars.txt? [15:42] no Rakshit__ [15:42] only git add -u [15:42] prabhu: how did you do the last commit? [15:42] yes, same happened with me [15:43] sayan, https://snag.gy/TRGDw3.jpg [15:43] ! [15:44] prabhu: your log clearly says "Nothing added to commit but untracked files present" [15:44] prabhu: when you did the commit "Add the file hellomars.txt" [15:44] same as pr [15:44] same as prabhu [15:45] so you all missed git add [15:45] next [15:45] In hellomars.txt should be added "Mars is the added planet" ? [15:45] ! [15:45] poojaencoded: yes [15:45] next [15:46] if i do git add -u hellomars.txt why doesnt it add? [15:46] kps_: that's a wrong syntax [15:46] you add to do git add hellomars.txt [15:47] next [15:47] then why is -u used; i checked the man page but didnt get [15:47] sayan, we need to use git add before git add -u? If yes, why are we adding two times? [15:47] prabhu: when are you doing it two times? [15:47] prabhu: you clearly did not follow the steps [15:47] first git add, then git add -u [15:48] I told create a new file [15:48] and create a commit for that file [15:48] and then I told add new changes [15:48] I did, you can check my screenshot again [15:48] and then git add -u [15:48] prabhu: who will add the file after creating the new file? [15:49] ! [15:50] Now another way to add the change is git add -u--> Is this used to add text? [15:50] prabhu: yes, the changes [15:50] when untracked, you always use git add filename [15:51] there are other not recommended methods like git add . [15:51] but if the files are in untracked you have to add them [15:51] sayan, just tell the difference between git add and git add -u? I am confused right now. [15:51] -u is the argument to git add [15:51] git add tracks untracked files, git add -u moves only tracked files to staging area, since hellomars was not tracked , we need to track it first, so git add hellomars. [15:51] sayan, got it [15:52] In the beginning of the class I told that the untracked files are not tracked by git [15:52] so any changes you do to then when they are in untracked they won't be tracked by git [15:53] to make them tracked by git, you use the command git add [15:53] So, git add is used just to track the files and git add -u to move them into the staging area. Right? [15:53] once they are added, for the consecutive git you can use `git add -u` [15:54] in that case, it will pick up the changes for the files in the tracked area to staging area [15:54] sayan, is my statement correct? [15:54] sayan, its all making sense now [15:55] -u is used to add the already tracked files to the staging area [15:55] prabhu: you can use git add later also [15:56] but -u as kps_ said is used to add the already tracked files to the staging area [15:56] -u specifically moves modified and deleted files to staging , to move all files use -A [15:56] I mentioned the same when explaining too [15:56] 15:38 *- Now another way to add the change is git add -u [15:56] 15:39 *- git then adds all the changes from the tracked files to staging area [15:57] next [15:57] How can I see what files are present in my git directory? [15:57] ls [15:58] But those show untracked files too. [15:58] How do I see the tracked files? [15:58] sd30: yes [15:58] just the tracked files, I don't know if there is solution [15:58] and I don't recommend too [15:59] Okay. Why not? [15:59] Why would you need that? [15:59] you can do git status to see what is not tracked [15:59] 1l [15:59] Okay point. Thanks sayan [16:00] Roll Call [16:00] Shiva Saxena [16:00] Sahil [16:00] Anu Kumari Gupta [16:00] Gajendra Saraswat [16:00] Avik Mukherjee [16:00] tabrez khan [16:00] Kumar Vipin Yadav [16:00] Abhilash Raj [16:00] Naman Sharma [16:00] Ola Ajayi [16:00] Priyanka Saggu [16:00] Prabhu Sharan Singh [16:00] Mayank Singhal [16:01] Neeraj Kumar Arya [16:01] Shruti Dash [16:01] Priyanka Sharma [16:01] Sourabh Pruthi [16:01] Sehenaz Parvin [16:01] Rakshit Airani [16:01] Rajat Gupta [16:01] Karan Pratap [16:01] Ratan Kulshreshtha [16:02] Manank Patni ----END CLASS----