Today sundayschool was special as the whole session was conducted online on IRC , around 20 attended.. Vikram Vincent handled the session. We upload IRC log for further reference.

[09:58] will start at 10AM [09:59] two more minutes for class to start [09:59] since we dont have to go anywhere else we will maintain punctuality [10:00] ya thank you for reminding @vincentvikram [10:00] its 10:00 [10:00] yup [10:00] haarika_: haarika hello [10:00] ready steady go :p [10:01] akshatha: hello [10:01] enigma: [10:01] hello [10:01] punith: sony_ pavi psacrifice kaustavdm 77CAAJ7PZ [10:02] hmm people quit when I say hello huh :P [10:02] hehe.. [10:03] Do call your friends and see if they need any help to join [10:03] okkk [10:05] Hi omeama [10:05] hello sir [10:06] Do call your friends and see if they need any help to join [10:06] i called one of my friend [10:07] punith needs to make up his mind whether he wants to join or quit ;) :D [10:07] u didnt say hello to him... thats y:P [10:08] i guess [10:08] whos fsmk [10:08] akshatha: I did! see above [10:08] == fsmk has changed nick to Shijil [10:08] I acknowledged everyone's presence [10:09] I love fsmk becoming Shijil [10:09] it is like superman to clark kent [10:09] Ha ha [10:10] It is 10:10 [10:10] I shall start the session now [10:10] <Find\_Me\_Out> Not me :P [10:10] G'morning  all! [10:11] is git installed in the camp distro [10:11] Good morning [10:11] hope you had a good night's rest and are ready to learn about this awesome tool called git [10:11] rolwin, just type git and see [10:11] Some rules [10:11] gud mrng [10:12] I will type out my presentation and you will have to try out the instructions on your laptop [10:12] okk [10:12] good morning.. [10:12] you may tag me in a question but label it as questions [10:12] example [10:12] vincentvikram: Question: how do you...? [10:13] karthikmanisha: will collect all the questions and send me as a private msg as I may miss them otherwise [10:13] Are you all ready? [10:13] vincentvikram: okay [10:13] vincentvikram, I can also help answering few [10:13] yes :) [10:13] yaa [10:14] ^^ you all need to reply so that I know you are not watching TV :P [10:14] :D [10:14] Shijil: sure. But I think we should answer questions towards the end so that the flow is not lost [10:14] * Find\_Me\_Out is waiting for session to start [10:15] Let us start with installing git first [10:15] If all of you are using a Debian based system like Debian or Ubuntu then open your terminal and type [10:15] $ sudo apt-get install git [10:16] If you are using a Redhat based system then the command would be $ sudo yum install git [10:17] An overview [10:17] git is known as a version control system [10:17] Small examples from my own usage [10:17] I write a lot of notes for my reports in plain text [10:18] so mainatining what was written/deleted/updated over a period of time becomes difficult [10:18] my system is telling git version 1.9.1 [10:18] Hence I ask git to maintain versions of my file and content and track changes [10:19] this way I know exactly what changes have been taking place [10:19] Allows me to track both qualitative and quantitative changes [10:19] Second example [10:19] I write code [10:20] Again tracking changes of code becomes simple with git [10:20] But the biggest advantage of git is the fact that it allows for collaboration [10:20] Collaborative creation of knowledge where we know who is contributing what, when and why [10:21] The why part of the contribution comes in the form of log messages that one would have to supply when submitting changes [10:22] I will be providing all the references being used during this interaction at the end [10:22] Create a folder called git and move into it via the terminal [10:23] n order for git to start tracking changes we need to initialise the state of the folder [10:23] *In [10:23] The '$' sysmbol indicates the terminal prompt so please do not type that [10:23] $ git init [10:24] when you type the above 'git init' command you should get something like "Initialized empty Git repository in /home/vikram/git/20150816/.

git/"
[10:25] I created a folder within my git folder
[10:25] So the entire state of the system is stored in the form of metadata within the .git folder
[10:26] even minute changes will be tracked
[10:26] we will make some configurations to personalise our experience
[10:27] $ git config --global user.name
[10:27] ^ Replace with your name example Vikram Vincent
[10:27] Discard  the '<>'  symbols
[10:27] $ git config --global user.email
[10:28] Where you replace with your email
[10:28] use an email id that you think will be used in the long term
[10:28] and better if it sounds professional too ;)
[10:29] bunnyrabbit126@gmail.com
[10:29] may not look good on your resume :D
[10:29] :D
[10:30] When making changes permanent, git normally prompts you to write a short message
[10:30] so it is good to configure your favorite text editor as default
[10:30] $ git config --system core.editor
[10:31] Replace by emacs or vim or nano or gedit or ...
[10:31] but any one
[10:31] All data within .git are stored as plain text
[10:31] and this is the beauty of git
[10:32] your configurations are stored within .gitconfig in the same folder
[10:32] you may see the hidden files using $ ls -la
[10:33] we shall now start by adding a file
[10:33] There are two ways to do this
[10:33] either you create a file manually, make changes then ask git to track it
[10:33] OR
[10:34] create a file through git when then means that git tracks your file/folder from the start itself
[10:34] I use both options based on convenience
[10:34] It might be better to use the latter option when multiple people are working together
[10:34] $ git add initial.txt
[10:35] creates a text file which is now being tracked
[10:35] An abstraction of the command would be $ git add
[10:35] or $ git add
[10:36] As you know all directories are also considered as files in the UNIX philosophy
[10:37] I would suggest that you fill the newly created file with around ten lines of content
[10:37] This would form the initial content
[10:37] As content is being added
[10:38] to a tracked file, the data is at a place called the staging area
[10:39] Sometimes you may get an error like "fatal: pathspec 'initial.txt' did not match any files"
[10:39] when doing git add
[10:39] you may then create a file by $ touch and then $ git add
[10:40] Two definitions you need to know for now are for 'staging area' and 'commit'
[10:40] Definitions: Staging Area: A place where we can group files together before we "commit" them to Git.  Commit  A "commit" is a snapshot of our repository. This way if we ever need to look back at the changes we've made (or if someone else does), we will see a nice timeline of all changes.
[10:41] A snapshot is like taking a picture with a camera
[10:41] the picture captures the state in that instant
[10:42] So you may have been crying till then but decide to smile just for the photo :D
[10:42] But that sounds like the Facebook display picture
[10:43] If you have entered around ten lines of content into 'initial.txt' file let us now see the status of the folder/file
[10:44] $ git status
[10:44] On branch master  Initial commit  Changes to be committed:   (use "git rm --cached ..." to unstage)      new file:   initial.txt  Changes not staged for commit:   (use "git add ..." to update what will be committed)   (use "git checkout -- ..." to discard changes in working directory)      modified:   initial.txt
[10:45] If you look carefully
[10:45] you will understand that git is telling you that you need to add the initial.txt file to the staging area if I want it to be committed
[10:45] I could also discard the changes
[10:46] The output of git is pretty self-explanatory
[10:46] But you can ask questions if you have doubts
[10:47] So, we will now add the changes to the staging area with the command $ git add initial.txt
[10:47] git does this quietly
[10:47] git might give warnings if more than one person is working on the same file simultaneously
[10:48] but we will deal with that situation separately
[10:48] So let us now commit the data we have staged
[10:49] 'Commit' indicates that the data changes along with all the metadata becomes a permanent part of the development history
[10:49] As I mentioned before, the history tracking via metadata is git's strong point
[10:49] even the minutest of data can be tracked
[10:49] *minute
[10:50] Two ways of doing a commit
[10:50] first way
[10:51] you can simply do $ git commit where filename is what was added to the staging area in the previous step
[10:51] Git will then open your favorite editor and ask you to write a message
[10:52] Do ensure that the message you add is under 80 characters
[10:52] and is self-explanatory
[10:52] it should not something like "made changes to "
[10:52] rather should describe the specific changes
[10:53] The second way to commit data is as follows
[10:53] $ git commit initial.txt -m "Initialised file. filled data from output of dmesg"
[10:54] where -m indicates that the message follows
[10:54] and the message is enclosed within the double quotes
[10:55] The reason why you need to keep the msg under 80 characters is so that it does not spill out of the screen
[10:56] for example, when I am seeing a list of a hundred commit messages I should be able to see all the msgs without having to scroll left-right
[10:56] what is the primary difference between apache's subversion and git?...which one do you think is better in terms of the repository?..is it better to have a decentralised system?
[10:59] kumarsudesh: there are several major advantages to learn and use git. For a novice this is irrelevant. However, for the advanced user it becomes obvious. I will simply leave you with a source I think is relevant to understand the difference https://stackoverflow.com/questions/871/why-is-git-better-than-subversion
[11:00] rolwin asked: so this git allows u to make chages to ur previous file even after sving the new one
[11:00] The answer is yes
[11:01] You are free to make any changes you want to any set of file
[11:02] For example, if there are ten files and you make changes to first and third file and want to save only the third file then you simply do $ git add thirdfile
[11:02] $ git commit thirdfile -m "message"
[11:02] Similarly, you may add/delete the first file once you are done
[11:03] Commiting individual files and changes is a good way of working
[11:03] this allow changes to be tracked better
[11:03] cause if you add and commit several changes of files and content at the same time it will be difficult to track them later on especially if you are searching for bugs
[11:04] Example, let's say that your code was working fine. then a set of changes were made to the code. If all the changes were added and committed at the same time then it would be difficult to know exactly which change introduced the bug
[11:05] Thus, it is better to keep each commit to specific "blocks" so that one may be able to revert or roll-back changes if needed
[11:05] that is, undo some work
[11:05] this way any bad code can be removed or debugged
[11:06] NOTE: Keep commits isolated to logical sections/files/functions
[11:07] However, you may commit all the changes at one shot too
[11:07] You can use the command $ git commit -a
[11:08] where the -a switch indicates all files/changes that were added to the staging area
[11:09] When you commit you may get a msg like "planethacker% git commit initial.txt [master (root-commit) 4292573] Added content of demsg to the initial.txt file  1 file changed, 1596 insertions(+)  create mode 100644 initial.txt"
[11:09] Run $ git status
[11:10] planethacker% git status  On branch master nothing to commit, working directory clean
[11:10] ^ the above msg is assuming that you have commited any other changes you have made
[11:10] Or that there were no other changes
[11:11] Now you want to check the log file to see the important meta data
[11:11] $ git log
[11:11] commit 4292573d6220b8c3b1b9dd1b060b8bf3ab1b0ec7
[11:11] Author: Vikram Vincent <vincentvikram@gmail.com>
[11:11] Date:   Sun Aug 16 10:50:44 2015 +0530
[11:12]      Added content of demsg to the initial.txt file
[11:12] You should get some output with similar data
[11:12] the commit hex value helps in tracking changes very accurately
[11:13] Normally, there can be no two changes that will ever conflict cause the probability is very low
[11:14] that is, for the hex value to ever conflict, all the parameters that git borrows to create the hex should be exactly alike which is extremely rare
[11:15] Task: Add/remove a few lines from your initial file and then add-commit the changes with proper commit messages. Look for status and log
[11:15] I will pause for 4-5 mins while you do that. You may ask me questions
[11:18] what would be some of the best graphical git clients for linux?
[11:20] kumarsudesh: Personally I don't use git gui as I need the power and flexibility of the terminal. However, you may use https://git-scm.com/download/gui/linux to select from the list
[11:20] I forked a github repo to my account. I want to replace the files and directories present in the forked repo with files from my system, and upload them back to my github account, and also make a pull request for the original repo owner. How do I do that ?
[11:21] jaikishanjk: let me answer your question in parts
[11:22] When you say replace files and directories there are a few interpretations
[11:22] it could be delete old ones and add new ones
[11:22] or make changes to existing file structure with new content
[11:22] the former also has changes to content
[11:22] I mean delete all the files, and add new files.
[11:23] ok
[11:23] then $ git rm
[11:23] $ git rm -r <file/folder>
[11:23] where the -r switch indicates recurssive
[11:23] that is, go into a folder and delete each file
[11:24] you may specific folder/file too
[11:24] if you want to delete a specific file within a folder
[11:25] I guess deleting and adding files are tedious using command line
[11:25] actually, you don't want to make mistakes so doing it by hand keeps things safe
[11:25] Coz I wanna delete EVERYTHING!
[11:26] rather you can make mistakes too
[11:26] and undo them later
[11:27] jaikishanjk: sure you can delete everything and then undo later cause the .git folder will still contain the state right from the time you tried to pull content from an external source
[11:27] What do I do when I'm done with replacing the files ?
[11:27] commit the changes locally
[11:27] ie., to your hard disk
[11:28] Right now, I have not gone to github yet
[11:28] Then push it to my github account ??
[11:28] I am still with git
[11:28] Will deal with the github part separately
[11:28] but in short
[11:28] Yea, I'm well aware of it
[11:28] Okay
[11:29] jaikishanjk: you would have to push your changes to your github account and then using the graphical interface of github, ask the original author to accept your pull request
[11:30] personally, I may not accept such huge changes as a pull request (PR) as I may not understand why you made all those changes
[11:30] I tried but came across some public key errors!
[11:30] I might just ignore or ask you to host it on your account itself
[11:30] jaikishanjk: this link talks very specifically about PR https://help.github.com/articles/using-pull-requests/
[11:30] But the owner wants me to do it that way! :D
[11:31] yes, cause that is the only way they can track changes
[11:31] ok, so coming back to my presentation
[11:31] Thank you!
[11:31] are there any  ways to tweak the type of information i get from a git log so that it suits my needs?
[11:32] We did init - to initialise the local git repository, add files, remove files using $ git rm or $ git rm -r
[11:33] We changed config files usind the $ 'git config' along with specific options
[11:33] kumarsudesh: define tweak
[11:34] We also tried out log, status
[11:35] git was written by Linus Torvalds to manage the mamoth project of the Linux kernel so he created features to improve efficieny
[11:35] *efficiency
[11:35] by tweak i meant change the fields i get
[11:35] So it is good to read some of his comments on the logic behind git
[11:38] I am adding a few links of comments by Linus Torvalds
[11:38] I think you should spend some time and read them later
[11:39] I have not added the intermediate comments and leave that as an exercise for you
[11:39] https://github.com/torvalds/linux/pull/17#issuecomment-5654674
[11:39] https://github.com/torvalds/linux/pull/17#issuecomment-5659933
[11:39] https://github.com/torvalds/linux/pull/17#issuecomment-5660417
[11:39] https://github.com/torvalds/linux/pull/17#issuecomment-5661185
[11:39] https://github.com/torvalds/linux/pull/17#issuecomment-5663733
[11:39] https://github.com/torvalds/linux/pull/17#issuecomment-5663780
[11:40] Linus explains the reason for msg length
[11:40] use of git log
[11:40] signing-off on code
[11:40] pull requests
[11:40] web interface versus plain text
[11:40] and a lot more
[11:41] reading the conversation is very insightful and you will understand some of the tougher ideas as you use git more
[11:42] So the log messages can be customised
[11:43] the default being $ git log
[11:43] where the next would be limiting the number of log messages to latest
[11:43] example: $ git log -n
[11:44] $ git log -n 5
[11:44] would show the last 5 commit messages
[11:44] $ git log --oneline
[11:44] would shorten the commit msg to a single line
[11:45] this is useful when scrolling through a massive list and you need to compare quickly
[11:45] Try $ git log --stat
[11:46] You can also search by author
[11:47] example git log --author="Vikram"
[11:47] $ git log --author="Vikram"
[11:48] So yes, you can tweak the log to your needs
[11:49] Before continuing I will share the references I have been using
[11:49] References
[11:49] 1. https://www.atlassian.com/git/tutorials/setting-up-a-repository
[11:49] 2. http://www.vogella.com/tutorials/Git/article.html
[11:49] 3. https://git-scm.com/docs/gittutorial
[11:50] thank you
[11:50] 4. https://www.codeschool.com/courses/try-git // This is a quick interactive introduction to git
[11:51] I would highly recommend all of you to try reference 4 now
[11:51] before quitting this session
[11:51] Cause the session will end at 12 noon
[11:51] so i will await question
[11:51] *questions
[11:51] Please try out reference 4
[11:52] it will take you a max of 15 mins
[11:52] there are notes and everything so do look around the screen
[11:52] You may have to scroll up-down a bit
[11:52] Open for questions?
[11:56] I'm still here and I hope all of you are trying our reference 4
is there any way i can get my web server or browser to intergrate with my local repository?
[11:59] kumarsudesh: yes
[11:59] You need to set up git as a server
[11:59] and publish the link to collaborators or yourself
[12:00] $ git clone
[12:00] The syntax changes depending on the location of the git server
[12:02] So thank you all for joining
[12:03] do ask your questions either on the fsmk-discuss email mailing list or on the Telegram group where our friens will answer all doubts patiently
[12:03] We shall close the online Sunday school here
[12:04] Thanks once again :)
[12:07] The log will be posted on the fsmk website under Sunday school resources </div>