Chapter 1

It all started with the fact that they gave me a PipBoy. A very convenient thing: I wanted a pizza - I dialed the
callPizza()
command and now the courier is carrying you a hot lap! “How cool!” I thought.
I recently got a job as a programmer. My colleagues immediately began to praise the Git version control system. Well. Once they say that good - you need to read about it. After reading the first book in my head was a mess. I absolutely did not understand anything. “What kind of babuynya is this? Why do we need it at all? ”It seemed to me.
After a hard day's work, I headed home. It was a warm August evening, the kids were playing in the courtyard. Each of them had a PipBoy on their hand. How much technology has penetrated into our lives. After all, most recently this was nothing, and the first samples were worth hundreds of thousands of dollars. And now almost everyone has his hand! Immersed in my thoughts, I did not notice at all how someone was riding a motorcycle from around the corner. Rushing at great speed, he completely did not notice people on the road. And even more so in the yard.
I received a sharp blow to the chest and immediately fell on the asphalt. Still a little lower and hit the solar plexus, would have to die and be resurrected. But the head still fell well. His eyes darkened sharply, and his ears buzzed. It took about 15 seconds while my body tried to recover from a strong blow. The eyes began to see the picture again. A girl leaned over me and asked something. I read my lips: “Are you alright?”. After a couple of seconds, the hearing was restored and I was able to answer: “It seems yes. Now everything will pass. ”
- commits to do.
- Sorry what?
“Well, commits are a bit of a state save.”
- What are you talking about now?
- Damn, of course! You are a developer, right? I saw you at CoolTechnologies. Apparently you installed Git on your PipBoy?
- Yes, I am a developer. But I haven't heard anything about Git on PipBoy.
- Well, yes, he is not particularly known and popular. For now. In general, it is black magic!
- Eeee ...
- Let me install you too. But don't tell anyone about this! It is better to talk about Git only to those who are able to understand it and not to mess things up.
- Good. Thank.
After a couple of minutes, a shell was launched on my PipBoy waiting for the command to be entered. Thin fingers quickly scored
git init
')
- Dial
git commit -am "First commit of my life"
- prompted the girl.
I typed a command, pressed the enter button. Git brought something to the shell, but for now it was a dark science.
- Well that's all. Now look! - and she hit me in the eye with all her might.
- What are you doing?! - I shouted, not expecting such a turn of events.
- Shut up! Write to shell
git reset --hard HEAD
“So how does this help me not to kill you for what you did?”
- Do what they say! - She said angrily.
And yet I obeyed. As soon as I entered the team, the pain in the eye disappeared. I did not believe it and ran my hand over my face.
- As if nothing had happened, - her face broke into a smile. - Then you can do it yourself.
- Thank. But I never knew your name.
- Liza. Good luck!
- Thank you. Good luck!
Chapter 2

Need to learn Git! Urgently! The story that happened to me just struck me. I opened the browser, went to a large electronic library and typed a few books. I wanted to immediately read that for two teams a girl suggested to me. So,
git commit
saves the current state, and
git reset --hard HEAD
cancels all current changes and returns me to the last state.
"So, on what to try ..." Various thoughts sank into my head. The time was later, to work you need to get up early. Having a little snack and a shower, I decided to make a commit:
git commit -am 'Test commit'
After committing, I undressed and got into bed. “Who is this girl? How does she know me? She said she saw me in the company, but for some reason I did not see her there. Probably just did not pay attention. It would be nice to meet her again, invite her to dinner and ... So. Let's stop on this for now. ” I rotated a little more, and the shroud of sleep swallowed my mind. Slept awful again.
The morning came and I felt completely overwhelmed. Everything was dry in my throat, my head ached terribly. "Heck! And yesterday, after all, my head did not hurt so much! ” And then it dawned on me. I type on my PipBoy the already well remembered command
git reset --hard HEAD
and the head, as if under the influence of morphine, is relaxing. "ABOUT! And I'm dressed and well fed! Class! "
It was decided to take a book with me on the way to work.
Chapter 3

“Oh, and it would be nice if I could dress in new clothes every morning. Well, or at least every day to change the set of clothes, ”- I thought. I do not want every morning to take care of stroking another shirt and putting it on. Easier and faster to wear the same that wore yesterday. Yesterday I learned about branching at work and wanted to apply the same principle. So, I need to create a new branch. Fingers went over the keyboard and scored a new
git branch _"
So, it seems that now you need to switch to this thread of changes. I still decided to look into the Git tutorial, because yesterday poorly remembered this topic. “Exactly! Git checkout! ”- and typed
git checkout _
Yeah, now I'm on a new thread. Need to get dressed and save state. Blue shirt with thin white stripes, black socks, black pants and perfectly ironed jacket. Tie? To hell with him! I hate it when something presses on my neck! I make a commit and try to create a branch on Tuesday.
âť‹ git branch _ && git checkout _
Wear a white shirt and a blue suit. Looks like I'm starting to feel the pleasure of it! All subsequent days, I can simply return to these commits and will be immediately dressed! A sense of self-importance was growing before our eyes.
Time flew by. It took an hour to change clothes and create commits. I glanced at my watch and ran to the door. So, we must quickly dress and run! Damn, what does the boss say? On the move, I'll think of something. Why do I dress? He himself just made commits, noodle!
I change the branch to shirt__House, put on my shoes, look in the mirror: the usual home clothes that fit perfectly on my body. I can not understand what happened. "Why? I changed the branch and made a commit ”. I tried the branches of all days of the week, but the result was the same. I open the book on Git and look for the reason for my slip. “Well, yes, I did
git checkout
. Yes, I made sure that there are any changes in
git status
. But
git add
forgot! Damn, I forgot to add new clothes. All work down the drain! It would be better dressed in the old manner. "
Chapter 4

If you can use different repositories, then for sure there are repositories with improvements for the body and other things. And many more people can come together and make super cool improvements! A whole team of surgeons corrects errors in the work of the organs! Just think about it!
Or, for example, a team of builders is trying to innovate in the construction of bridges and buildings, without risking almost anything. They erected a foundation - they kept their condition, they built the floor - they saved it again. Something went wrong - they rolled back and rebuilt the site. Amazing beauty of the building and no danger that the building will not fall apart during construction.
Hmm, I need to find something interesting. I open the page in the browser and look for something on the subject of Git commands. But there is nothing in the search results. The phrase came up in my head "... don't tell anyone about it! It’s better to talk about Git only to those who are able to understand it and not to mess things up ..." It seems that not everyone should know about Git. You need to try to connect to an anonymous network and search for something there! After some time, managed to find a couple of interesting projects.
The first project brings together employees of various medical organizations. Together they try to improve the work of the heart. With today's ecology, all this becomes very promising. Surely after a lot of tests will earn on this. Who likes to be an old man with a bad heart? The guys in white coats will help! Well, that's their business. We must try to find out from the participants what they were able to achieve. It may be possible to do something with my heart defects.
The second project aims to create and manage spacecraft. Multimillion technology, what can we say! In addition to building rockets using Git, they also launch launches using a version control system. A bad launch can now always be rolled back. First, launch an empty rocket, without astronauts. If everything goes well, then they roll everything back, astronauts are put in a rocket and sent into orbit.
There were other interesting projects, but they arranged for me much less: “Successful childbirth”, “Preservation of innocence” (Damn, now you can't even be sure about that!).
Chapter 5

There was porridge in my head. Yesterday it was obviously worth drinking less.
Out of habit, I got dressed and had breakfast as a team. Git has become a daily necessity, and turned me into a hostage of technology. And let it be! The world does not stop and always moves forward, not backward. It is better to use new technologies than to be afraid of them.
Immediately the picture was presented: in 1945 Soviet troops approached Berlin. And then one of the generals says: “Stoooooooooy! Stop the attack! If we win now, in the future computers will be used everywhere and our grandchildren will sit behind them! Come back, we do not need such a future! ”
Good thing no one heard my laughter. It would be hard to explain.
Coming out of the house, I felt a tingling in my heart. What happened with me? After all, for so many days everything worked like a clock! We need to deal with these heart patches that I made last week. But there are so many commits! And besides, I still do not know the reasons. It was decided to immediately call on his friend, a cardiologist, he must say something.
His hospital was located in a beautiful and tall building on the outskirts of the city. When I entered the office, it was clear that Cyril was about to get angry with the uninvited patient, but he recognized me immediately and brightened me.
- Hello! Long time no see, Cyril.
- Greetings, my dear. How is your health?
- Why, just about him and came. Little heart is naughty, could you see?
- Of course! Undress to the waist and lie down on the couch. We just brought new equipment and I would like to check it in action. Absolutely unique technologies in the field of heart research!
I undressed, leaned on the "unique technology" to lie down, and my legs gave way. I barely managed to turn the body towards the couch.
- Get up! Get up, say! Damn, well, you got it. You have severe heart failure. I see that someone has already managed to conjure on your heart. Look, here you have continuous glitches in your heart, but it happened not so long ago. How did you do that?
“Sorry, I can't tell you everything.” Secret modern development
“Okay, that's none of my business.” Listen, I do not know who and what did with your heart, but you definitely need to ask to correct these errors. There is some very complicated logic of work, it will take a lot of time for me. In general, when your heart accelerates, sometimes the valves do not allow to pump blood. Since you were able to use these technologies, it would be better for you to contact the developers for help and fix it.
- Thank you, you really helped me.
- Get well.
How inconvenient it turned out! Cyril clearly did not want to be involved in some intrigue. I understand that perfectly. Well, but he gave me information about how and what to fix. We will look at the patches and look for the problem. So, he said, about the fact that this error manifests itself during the acceleration of the heart. So I will behave very calmly, try to minimize efforts. I decided to look at commits in patches and was horrified: there are so many commits! And they are so voluminous! Damn, I can't manage this here in my whole life.
Need to go to work. Maybe take a day off at least for today? No, let the guys down, and so barely have time. And then I got the idea to ask my colleagues. Yet they knew Git much better than me.
- Guys, how do you find bugs in some function that previously worked and then stopped?
- Differently, - Alexey answered. - Usually, it is enough to checkout 1-2 of your commit. If this does not help, then most likely the error occurred because of someone. Then you need to use
git bisect
- Ok, I'll try now.
I am writing in the console
âť‹ git bisect start
âť‹ git bisect bad
So, you should try the latest stable version.
âť‹ git checkout v2.1
It is necessary to disperse the heart. Hmm, just have time to run a little. I go out, and there is just great weather. The heart happily responded. No, I'm just satisfied. I start the race, people stare at me as if they were crazy. I wonder if this will ever stop? Do they have their own problems? After a while I stopped noticing anyone around. Running was fun. So that's what I did not get so long. Damn nature, why can't we be born healthy right away? Although yes, people do not appreciate what goes for free. That's right. It seems that there are no errors in this version of the heart firmware, I feel absolutely good. Git needs to point this out.
âť‹ git bisect good
Bisecting: 6 revisions left to test after this
[f71ce38690acf49c1f3c9bea38e09d82a5ce6014] fix heartrate
On this day, I tried to change the firmware of my heart two more times, but the error did not manifest itself. The circle of suspected commits was reduced to one commit, it will be necessary to study it after work! Wonderful thing this git!