<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: JDeep</title>
    <description>The latest articles on DEV Community by JDeep (@jdeepd).</description>
    <link>https://dev.to/jdeepd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F422599%2F93e305ab-2a96-4eda-9abd-8df7e0f73241.jpeg</url>
      <title>DEV Community: JDeep</title>
      <link>https://dev.to/jdeepd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jdeepd"/>
    <language>en</language>
    <item>
      <title>Bisect: A severely underrated git command</title>
      <dc:creator>JDeep</dc:creator>
      <pubDate>Fri, 27 Aug 2021 16:58:32 +0000</pubDate>
      <link>https://dev.to/jdeepd/bisect-a-severely-underrated-git-command-3mgh</link>
      <guid>https://dev.to/jdeepd/bisect-a-severely-underrated-git-command-3mgh</guid>
      <description>&lt;h1&gt;
  
  
  &lt;code&gt;git bisect&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;Ever faced a situation where you made multiple commits to your project only to break a feature which you are sure it worked properly before you went on the commit spree?&lt;/p&gt;

&lt;p&gt;How on earth do you even plan to begin debugging the code in such a scenario? &lt;/p&gt;

&lt;p&gt;One could go on a brute force approach but wouldn't it be much easier(to debug) if git just tells you which commit messed up your feature?&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git bisect&lt;/code&gt; does exactly that.&lt;/p&gt;

&lt;p&gt;Suppose I have a commit history as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fejmscs6jcw0b1a6pb25t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fejmscs6jcw0b1a6pb25t.png" alt="Git Log"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lets say my feature worked properly in &lt;code&gt;29aa243&lt;/code&gt;. I want to find which commit between  &lt;code&gt;29aa243&lt;/code&gt; and &lt;code&gt;d3bf6d2&lt;/code&gt; broke my feature.&lt;/p&gt;

&lt;p&gt;Before beginning to bisect the commits, lets get a basic understanding of the involved commands&lt;/p&gt;

&lt;h4&gt;
  
  
  To start bisecting, we run the command :
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git bisect start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would start a bisecting session where you have to test your feature and tell git if it works fine or is still broken.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git bisect good &lt;span class="o"&gt;[&lt;/span&gt;optional commit] &lt;span class="c"&gt;# If the feature works fine&lt;/span&gt;
git bisect bad  &lt;span class="o"&gt;[&lt;/span&gt;optional commit] &lt;span class="c"&gt;# If the feature is still broken&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a simple logic graph of the process:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz7v9hq3y1dpi7z8zo4fa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz7v9hq3y1dpi7z8zo4fa.png" alt="Logic Graph"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, We have to first initialize which commit is &lt;code&gt;good&lt;/code&gt; and which is &lt;code&gt;bad&lt;/code&gt; . In this scenario, my &lt;code&gt;d3bf6d2&lt;/code&gt; (current HEAD) is bad and &lt;code&gt;29aa243&lt;/code&gt; is good. Do this with the help of commands given above &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy8kiuj92l0urjirgf96n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy8kiuj92l0urjirgf96n.png" alt="Git bisect"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now test your feature and subsequently go through the logic graph given above(&lt;strong&gt;Note: It is very important that you donot begin to commit on the codebase in a Bisecting Session. Since the HEAD remains in a detached state in such session, it would give you a hard time fixing everything later. See the last part of this article on how to exit Bisecting Session&lt;/strong&gt;). &lt;/p&gt;

&lt;p&gt;In the end of all revisions, git will tell which  commit broke your feature :]&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl0hl4icxrlrbc8mbd9vr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl0hl4icxrlrbc8mbd9vr.png" alt="Git Bisect 2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that you have found your guilty commit, its time to reattach your &lt;code&gt;Detached HEAD&lt;/code&gt; back to &lt;code&gt;master&lt;/code&gt;. Do this to reattach your detached HEAD&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git bisect reset
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Good luck with debugging that commit 👍. Here are some more sources to learn about &lt;code&gt;git bisect&lt;/code&gt; :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://git-scm.com/docs/git-bisect" rel="noopener noreferrer"&gt;https://git-scm.com/docs/git-bisect&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/4713088/how-to-use-git-bisect" rel="noopener noreferrer"&gt;https://stackoverflow.com/questions/4713088/how-to-use-git-bisect&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>vcs</category>
      <category>bisect</category>
    </item>
    <item>
      <title>Bspwm installation on Ubuntu 20.04 [updated :2021]</title>
      <dc:creator>JDeep</dc:creator>
      <pubDate>Wed, 24 Mar 2021 14:12:52 +0000</pubDate>
      <link>https://dev.to/jdeepd/bspwm-installation-on-ubuntu-20-04-updated-2021-3kip</link>
      <guid>https://dev.to/jdeepd/bspwm-installation-on-ubuntu-20-04-updated-2021-3kip</guid>
      <description>&lt;h5&gt;
  
  
  Note : Donot blindly copy the commands otherwise very bad things will happen.
&lt;/h5&gt;

&lt;h2&gt;
  
  
  Step 1 : Install &lt;a href="https://github.com/baskerville/bspwm" rel="noopener noreferrer"&gt;bspwm&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;either by installing from the debian repository or by &lt;a href="https://github.com/baskerville/bspwm/wiki#from-source" rel="noopener noreferrer"&gt;building it from source&lt;/a&gt; .I will be using the debian repository for installation&lt;br&gt;
Run the following commands. Use &lt;code&gt;sudo&lt;/code&gt; if you are not root&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

apt-get update &amp;amp;&amp;amp; apt update
apt install bspwm


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You should get a prompt like this :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FNova-Striker%2Fmydotfiles%2Fblob%2Fmain%2Fpictures%2Fpic-1.png%3Fraw%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FNova-Striker%2Fmydotfiles%2Fblob%2Fmain%2Fpictures%2Fpic-1.png%3Fraw%3Dtrue" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See carefully that the dependencies like &lt;code&gt;bspwm lemonbar libxcb-ewmh2 sxhkd xdo&lt;/code&gt; are automatically installed so you dont have to install these manually. Keep in mind though that if you are building from &lt;a href="https://github.com/baskerville/bspwm/wiki#dependencies" rel="noopener noreferrer"&gt;source&lt;/a&gt; , you would need to install these dependencies manually either  from debian repository or by building them from source&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2 :Configuring bspwm and sxhkd
&lt;/h2&gt;

&lt;p&gt;Now the bspwm file was downloaded into your system and in almost all cases, the files are found in &lt;code&gt;/usr/share/doc/bspwm&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In this folder , there are example config files that you can use. Or if you want , you can make your config files from scratch.&lt;br&gt;
I will be using the examples configs to wrap it up faster&lt;/p&gt;

&lt;p&gt;From &lt;code&gt;/usr/share/doc/bspwm/examples&lt;/code&gt; we will copy the &lt;code&gt;bspwmrc&lt;/code&gt; and &lt;code&gt;sxhkdrc&lt;/code&gt; to &lt;code&gt;~/.config&lt;/code&gt; directory&lt;/p&gt;

&lt;p&gt;First make two directories (&lt;code&gt;bspwm&lt;/code&gt; and &lt;code&gt;sxhkd&lt;/code&gt;) in your &lt;code&gt;.config&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;Next copy the &lt;code&gt;bspwmrc&lt;/code&gt; and &lt;code&gt;sxhkdrc&lt;/code&gt; in &lt;code&gt;/usr/share/doc/bspwm/examples&lt;/code&gt; to your &lt;code&gt;.config&lt;/code&gt; directory using the following commands &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

mkdir ~/.config/bspwm &amp;amp;&amp;amp; mkdir ~/.config/sxhkd
cp /usr/share/doc/bspwm/examples/bspwmrc ~/.config/bspwm
cp /usr/share/doc/bspwm/examples/sxhkdrc ~/.config/sxhkd


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h2&gt;
  
  
  Step 3 : Making executables and firing up bspwm
&lt;/h2&gt;

&lt;p&gt;Normally , the &lt;code&gt;bspwmrc&lt;/code&gt; file that you copied just now should be an executable. You can check if its an executable or not from the &lt;a href="https://stackoverflow.com/questions/10319652/check-if-a-file-is-executable" rel="noopener noreferrer"&gt;this SO post&lt;/a&gt; or if you have a file manager like &lt;code&gt;vifm&lt;/code&gt; or &lt;code&gt;ranger&lt;/code&gt; then , placing the cursor on &lt;code&gt;bspwmrc&lt;/code&gt; file should highlight it in &lt;code&gt;green&lt;/code&gt; colour (which means that its an executable and you can proceed to the next step) &lt;/p&gt;

&lt;p&gt;See this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FNova-Striker%2Fmydotfiles%2Fblob%2Fmain%2Fpictures%2Fpic-2.png%3Fraw%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FNova-Striker%2Fmydotfiles%2Fblob%2Fmain%2Fpictures%2Fpic-2.png%3Fraw%3Dtrue" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If its not executable , then make it executable by &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

chmod +x bspwmrc


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h2&gt;
  
  
  Step 4 : Modifying the &lt;code&gt;.sxhkdrc&lt;/code&gt; so that you can open some apps after logging into bspwm.
&lt;/h2&gt;

&lt;p&gt;If you did the above steps correctly , you should see something like this in your &lt;code&gt;sxhkdrc&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FNova-Striker%2Fmydotfiles%2Fblob%2Fmain%2Fpictures%2Fpic-3.png%3Fraw%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FNova-Striker%2Fmydotfiles%2Fblob%2Fmain%2Fpictures%2Fpic-3.png%3Fraw%3Dtrue" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now change the default &lt;code&gt;urxvt&lt;/code&gt; terminal to the terminal of your choice. I will set &lt;code&gt;super + Return&lt;/code&gt; to my default &lt;code&gt;gnome-terminal&lt;/code&gt;.&lt;br&gt;
You can also add your keybindings for opening web browser. &lt;/p&gt;




&lt;h2&gt;
  
  
  Step 5 : Putting bspwm in your &lt;code&gt;.xsession&lt;/code&gt; or &lt;code&gt;.Xsession&lt;/code&gt; or &lt;code&gt;xsessionrc&lt;/code&gt; or &lt;code&gt;.xinit&lt;/code&gt; file.
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Note 1&lt;/em&gt; : Focus on the &lt;strong&gt;&lt;code&gt;or&lt;/code&gt;&lt;/strong&gt; in the heading. That means to do the following steps in only one file not all :-)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note 2&lt;/em&gt;  : Check if you have any the files in the heading in your &lt;code&gt;home&lt;/code&gt; directory. In my case I didn't have them so I had to make them.&lt;/p&gt;

&lt;p&gt;Making these files are simple. Just &lt;code&gt;touch .xsessionrc&lt;/code&gt; .&lt;/p&gt;

&lt;p&gt;Edit the file and put the following lines in it :&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

#!/bin/bash
exec bspwm


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Note 3&lt;/em&gt; : I got my &lt;code&gt;bspwm&lt;/code&gt; running by adding the above lines in &lt;code&gt;.xsessionrc&lt;/code&gt; . It may be possible that in your case you have to add the lines in &lt;code&gt;.xsession&lt;/code&gt; or any other file mentioned in the heading.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 6 : Making the &lt;code&gt;xsession&lt;/code&gt; file executable
&lt;/h2&gt;

&lt;p&gt;First &lt;code&gt;cd&lt;/code&gt; to your home directory where you have the file you created/modied in Step 5. &lt;/p&gt;

&lt;p&gt;Then open the terminal and enter the following :&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

chmod +x  .xsessionrc


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Note : I created a &lt;code&gt;.xsessionrc&lt;/code&gt; file. If you have used any other file in Step 5 , then make it executable instead !&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Logut and login again and you will be greeted with a black screen.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use the keybinding you added in Step 4 to open up the terminal and install essentials like &lt;code&gt;polybar&lt;/code&gt; , &lt;code&gt;picom&lt;/code&gt; etc&lt;/p&gt;

&lt;h4&gt;
  
  
  Sources:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://dev.to/l04db4l4nc3r/bspwm-a-bare-bones-window-manager-44di"&gt;https://dev.to/l04db4l4nc3r/bspwm-a-bare-bones-window-manager-44di&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.maths.cam.ac.uk/computing/linux/X/xsession" rel="noopener noreferrer"&gt;https://www.maths.cam.ac.uk/computing/linux/X/xsession&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/baskerville/bspwm/wiki" rel="noopener noreferrer"&gt;https://github.com/baskerville/bspwm/wiki&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://wiki.archlinux.org/index.php/bspwm" rel="noopener noreferrer"&gt;https://wiki.archlinux.org/index.php/bspwm&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>ubuntu</category>
    </item>
  </channel>
</rss>
