----BEGIN CLASS---- [17:34] #startclass [17:34] sayan: Is it your class, today? [17:34] priyankasaggu119: yes [17:34] Nilesh Patra [17:34] Rayan Das [17:34] Roll Call [17:34] Abhay Kaushik [17:35] Ritik Raushan [17:35] Ritwiz Sinha [17:35] Aniruddha Basak [17:35] Dev Arora [17:35] Bhavesh Gupta [17:35] Ankur [17:35] Priyanka Saggu [17:35] darshna das [17:36] Mrinal Raj [17:37] Mahendra Yadav [17:37] Pravar Agrawal [17:38] Sorry, missed previous two classes on Git, but went through the logs today. [17:39] so, what was last day's homework? [17:39] Reading this link: https://chris.beams.io/posts/git-commit/ [17:39] Learning commit practices [17:39] no, laptop turned off, went to look for charger [17:39] writing blog and know more about git log [17:40] paste the link to blogpost here [17:40] https://aniruddhab.home.blog/2019/07/22/filter-your-commits-through-git-log/ [17:42] https://bhaveshsgupta.me/blog/introduction-to-git-and-seven-rules-of-a-great-git-commit-message/ my git log post is still in drafts I have written this [17:43] What about others? [17:43] I loved both the blogpost put in appropriate references. [17:44] I couldn't. Landed yesterday late night here in Bangalore. But I'll write this week about SSH and Git. Two blogs. [17:45] i had missed last 3 classes. I'll start reading logs tonight. [17:45] I couldn't write a blog post by today on Git. Will try to finish it in this week. [17:45] week is a long time [17:45] I wrote a blog today on a different topic. will write blogs on git and ssh soon, :) [17:46] I also want to know why did you miss the class? [17:46] I haven't written it yet, was going through the logs but missed this part [17:47] this is my first time attending session,looking forward to learn from you guys.! [17:47] Okay, will try to write one in next two days. Let me push myself this time :) [17:48] I haven't been able to attend the previous classes on git , last class I attended was on ssh , due to various reasons . [17:49] sayan: I was travelling back to college. Internet was not working these days here properly, that's why i missed those classes [17:50] how many of you missed because you did not know? [17:52] sayan: I knew the class will be there since I checked the calendar. But, I was in Bengaluru this past weekend and wasn't able to identify my Nick since I forgot it's password. [17:52] Okay [17:52] Was able to do it few hours back this evening [17:52] me , I didn't know of class in the morning because I didn't attend the previous one [17:52] Anyways moving ahead [17:52] I am sorry, was working on creating .onion website blog. Will update git blog early. [17:53] *Chapter 3: Understanding VCS: Branches* [17:53] Few months more have passed. Tux visits a local workshop & presents one of his image. [17:54] Two clients love his image but one wants to add a Sepia tone to it and another want Black & White (B&W) [17:54] Tux now needs to change the work flow again, because over time Tux would be getting more and more clients. [17:55] Tux like Newton sat under a tree waiting for a apple to fall, but instead notices the branches of the trees which gave Tux an idea. A revolutionary one! [17:55] So Tux comes back home and starts working on the image. But now Tux creates two copies of images & names the directory as sepia & bw. [17:56] Tux who just happened to know linking, linked working directory to the sepia directory [17:56] So in the morning, Tux opens the working directory (which is pointing to sepia directory) opens the sepia directory [17:56] In the evening, Tux changes the link to bw, so Tux can work on bw image over the rest of the time. [17:57] Next time, Tux get a new client, Tux just needs to create new branch directory, link it to the working directory and start working. [17:57] any questions? [17:58] ! [17:59] nope [17:59] next [18:00] Could you please explain this part, "linked working directory to the sepia directory" [18:00] gandalfdwite: do you know soft link? [18:01] does it refer to soft link over here? [18:01] sayan: oh yes [18:01] next other questions? [18:03] nope [18:03] Okay [18:03] Moving ahead [18:04] I am picking gargantua_kerr[m to explain what state our git repository is in? [18:05] sayan: Our repository has softlinks to two other folders. [18:05] bw and Sepia (branches here) [18:05] gargantua_kerr[m: sorry, I meant our foobar repository [18:06] how many commits? files? etc [18:06] sayan: Two files and three commits [18:07] 2 files 3 commit [18:07] Okay [18:07] one file is still uncommitted [18:07] gargantua_kerr[m: which one? [18:07] sayan: hellomars.txt is unommitted [18:07] gargantua_kerr[m: oh right [18:08] I committed in my repo though [18:08] if you have any uncommitted changes, commit them [18:08] and tell when done [18:09] done [18:10] others? [18:10] i had commited yesterday [18:10] Okay [18:10] me too [18:10] Moving ahead [18:11] I have 3 commits [18:11] Usually when you start working on any new feature/fix bug you should start with a new branch [18:11] there is always a master (or similar branch) which should not be touched until required [18:12] now suppose in our example we just came to know pluto is a planet [18:12] so, what we would do? [18:13] $ git checkout -b add-pluto [18:13] where the syntax is $ git checkout -b [18:15] -b creates a new branch, and checkout to that branch [18:15] if you just want to change to a branch [18:15] use [18:15] $ git checkout [18:16] now create a new file, hellopluto.txt and add the text Hello Pluto in the file [18:16] tell me when done [18:17] done [18:17] done [18:18] Done [18:18] sayan: need to make hellopluto.txt in new branch, or the master itself? [18:18] I made in the master only [18:18] Done [18:18] gargantua_kerr[m: new branch [18:18] I've made a new branch add-pluto [18:19] ok [18:20] done [18:20] done [18:20] Now commit also [18:20] To check which you are in, type [18:20] $ git branch [18:20] this shows the list of branches, as well as the current branch you are in [18:20] done [18:21] done [18:21] ! [18:21] now if you see the log, you would see that there are 4 commits in the log [18:21] and move to the master branch that should have 3 [18:22] gargantua_kerr[m: increase 1 commit for yourself in both cases :) [18:22] next [18:22] sayan: does $git branch lists master branch as well? It isn't showing anything to me. [18:22] yes [18:22] I've only master and add-pluto branches [18:23] gandalfdwite: eh! how many commits do you have? [18:23] ! [18:23] Just one, the recent one [18:24] gandalfdwite: which is the recent one? the commit after adding pluto? [18:24] sayan: yes. Commit after adding pluto text file [18:24] gandalfdwite: how come you have only one commit? [18:25] sayan: I created a new directory for today's class, just now. [18:25] gandalfdwite: are you working on the existing directory? [18:25] Ah that's why i think [18:25] gandalfdwite: what happened to the exisiting one? [18:25] Why aren't you using the existing one? [18:26] sayan: oh, that one I deleted, after finishing the logs [18:26] well, i've nothing to say now. [18:27] I wonder if you read through the logs [18:28] I continued with the foobar directory on the second day and told in logs that there will be future classes [18:28] I'm not sure what made you delete the directory [18:28] anyways moving ahead [18:28] oh, sorry. I think I missed that part. Will create the directory again [18:29] others: did you see the difference in the number of commits? [18:29] the add-pluto branch would have 4 [18:29] and master would have 3 [18:30] yes [18:30] yes [18:30] to move between branches, use git checkout [18:30] git checkout master [18:30] git checkout add-pluto [18:30] ok [18:30] for our case [18:30] now you can keep on developing in the add-pluto branch [18:30] and when it is right time, or the branch is feature complete [18:30] you merge the branch into the master branch [18:31] this is the flow which is followed [18:31] Yes [18:31] now, do a 2 more commits in the add-pluto branch [18:31] s/do a/add/ [18:33] raydeeam: no issues [18:33] sayan: writing more tetin hellopluto.txt and committing it once after each change(total two changes). Is that what you mean? [18:33] gargantua_kerr[m: yes [18:33] done [18:34] who all are still doing? [18:34] donw [18:34] done [18:35] donw [18:35] done [18:35] done [18:35] Okay [18:35] now suppose the branch is feature complete [18:35] you need to merge it [18:36] so you first go to the master branch [18:36] and do [18:36] $ git merge add-pluto [18:36] done [18:36] done [18:36] done [18:37] done [18:37] (I prefer rebase and merge, but I feel rebase is a bit advanced topic so I'll people absorb git for few days before explaining) [18:37] now check the logs in master, do you see the commits from add-pluto branch? [18:37] yes [18:38] yes [18:38] ! [18:38] yes [18:38] yes [18:38] next [18:38] If we are working with other people does the command git branch displays their branches too, or just our branches ? [18:39] ! [18:39] ! [18:39] blank00: just the branches which are present in your machine, if you happen to pull the branches they pushed [18:39] you can see them [18:40] next [18:40] why the HEAD is pointing to both branch ? after all commits are merged on master? https://www.irccloud.com/pastebin/Rq2aj0qs/ [18:41] ! [18:41] blank00: how many question do you have? [18:42] 3 in total [18:42] aniruddhab: it says head points to master, and the commit is also in add-pluto [18:42] next [18:42] What if the master has a commit not in the other branch while merging ? [18:42] next [18:42] ok [18:42] blank00: you do a rebase, that what I told few minutes back [18:43] ok [18:43] That is bit difficult to absorb at the moment [18:43] so, I will teach it after few days, or maybe a week or two [18:43] till then think there is now updates in master [18:43] ok [18:44] blank00: also, there merge would happen, but there will be a merge commit incase there is a commit in master that is not in other branch [18:44] I will explain them all together [18:44] blank00: what is the other question [18:45] Can we create another branch of same name after merging [18:45] or is the merged branch still existing [18:45] names are unique, if after merging the branch would exist so you can't create a new branch with same name [18:46] so you would first need to delete the branch and then you create the branch again [18:46] ok [18:46] why is it so? it possible that you need to develop even after merging so you can keep the branch for a longer period of time [18:46] moving ahead [18:47] *Chapter 4: Understanding VCS: Remotes* [18:47] It's been an year now, Tux owns a shop now. [18:47] So, Tux uses cloud services to backup the photos & publish photos. [18:47] Tux has setup some network endpoints, so that when Tux drops the photos into a particular endpoints it backup the photos in the particular cloud. [18:47] ! [18:47] Tux's friend Nux is a computer programmer so who did the setup [18:47] The endpoints are origin: which points to Flickr [18:48] flickr: again points to Flickr [18:48] dropbox: points to Dropbox [18:48] 500px: points to 500px [18:48] When Tux runs: tux-shop push 500px sepia, it pushes the sepia photo directory to 500px [18:48] tux-shop push dropbox bw, it pushes the drop directory to dropbox [18:49] any doubts? [18:49] Okay [18:50] next [18:50] ! [18:50] next [18:51] From the previous chapter: suppose I make a new branch and change the file permission of a file which is present on master. Now if I merge the branch in master, what would be the new permissions? [18:51] okay , understood [18:53] gargantua_kerr[m: interesting question, that would all the things that happened after merge [18:53] next [18:54] any question from remotes? [18:55] the permissions changed on merging [18:55] blank00: there persmission are also tracked by git [18:55] s/there/the [18:55] Nope [18:56] That's an interesting point learned ! [18:56] tell me what would happen [18:57] for what sayan ? [18:57] tux-shop push origin bw [18:57] bw directory pushed to origin [18:58] bw will be pushed to Flickr [18:58] yes [18:58] ok , origin points to flickr [18:58] bw will be pushed to Flickr [18:58] Bw pushed to origin which is pointing to flickr [18:59] now how this related to our git repository? [18:59] right now we are working on a standalone project, alone [18:59] but suppose later, BhaveshSGupta aniruddhab raydeeam come together to build a project [19:00] so they create a organization "Bhar" [19:01] we would need a commonly accessible git server [19:01] suppose you all are collaborating over github [19:01] and the project name is loadtest [19:01] so, it becomes: github.com/bhar/loadtest [19:02] this is the parent project [19:02] Okay [19:02] each one of the three create a fork of the repo [19:02] so it becomes github.com/bhavesh/loadtest [19:02] github.com/aniruddha/loadtest [19:02] github.com/raydeeam/loadtest [19:03] each of them are in their respective machines [19:03] when they clone their fork which is github.com//loadtest [19:03] which by default is known as origin [19:04] now to add new remotes you use the command [19:04] git remote add [19:05] now they want to update the upstream url [19:05] so they use [19:05] git remote add upstream github.com/bhar/loadtest [19:05] so, origin points to github.com//loadtest [19:06] upstream points to github.com//loadtest [19:06] oops [19:06] upstream points to github.com/bhar/loadtest/ [19:06] understood [19:06] ? [19:06] Yes [19:06] yes [19:06] yes [19:06] yes [19:06] yes [19:06] ye [19:07] Yes [19:07] now whenever you code, you work locally offline [19:07] if you have to collaborate at some points of time you have to push your code [19:07] to that central git server, for us it's github [19:07] how would you do that? [19:08] git push origin master [19:08] this would push master branch to origin, which the user's fork [19:08] git push upstream master [19:08] this would push master branch to the upstream repo [19:08] similarly for pulling the code [19:09] you just change the command from push to pull, and it updates the code accordingly [19:09] any issues? [19:10] ! [19:10] next [19:10] The origin is our repository , in what condition would we need to pull it ? [19:11] blank00: maybe you use two laptops [19:11] you pushed from one, and want to sync in other [19:11] oh , yes [19:12] any more questions? [19:13] no [19:13] nope [19:14] nothing from my side [19:14] No [19:14] no [19:14] no [19:14] Home task: I need people to read this repo: https://github.com/joshnh/Git-Commands, and write a blog post where you write why would you use that command, not a one-liner, but explain the scenario [19:15] if there are commands which I haven't taught read and understand [19:15] then write one on it [19:15] Each should a good 5-6 lines [19:15] Okay? [19:16] ok sayan [19:16] ok [19:16] okay sayan [19:16] okay [19:16] sure [19:16] Be innovative, push your brains to the limit [19:16] It's not easy task, so i'm really looking forward how people put in their creativity [19:16] Okay [19:17] Taking today as 22nd though it's past 12 in India [19:17] Next class will be on 24th [19:18] so enough time to prepare yourself, complete the backlog. If you don't, actions would be taken [19:19] Roll Call [19:19] Nilesh Patra [19:19] Rayan Das [19:19] Ritwiz Sinha [19:19] Ritik Raushan [19:19] Aniruddha Basak [19:19] Pravar Agrawal ----END CLASS----