<?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: Student Edge</title>
    <description>The latest articles on DEV Community by Student Edge (@studentedge).</description>
    <link>https://dev.to/studentedge</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%2Forganization%2Fprofile_image%2F3354%2F46599be8-0033-4a93-873b-90ef50726c10.png</url>
      <title>DEV Community: Student Edge</title>
      <link>https://dev.to/studentedge</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/studentedge"/>
    <language>en</language>
    <item>
      <title>Rename folder to lowercase - Git</title>
      <dc:creator>Prayatna Bhattarai</dc:creator>
      <pubDate>Thu, 28 Jan 2021 06:52:14 +0000</pubDate>
      <link>https://dev.to/studentedge/rename-folder-to-lowercase-git-347d</link>
      <guid>https://dev.to/studentedge/rename-folder-to-lowercase-git-347d</guid>
      <description>&lt;p&gt;We are always having issues renaming a folder to lower case because git does not tend to understand the difference even if we change the folder.&lt;/p&gt;

&lt;p&gt;The way we would rename is:&lt;/p&gt;

&lt;p&gt;First move the folder to another temp. folder&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git mv src/Home src/homes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then move the folder to the desired folder name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git mv src/homes src/home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally commit the change&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m "rename folder from Home to home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are running windows, the rename may not reflect on the windows explorer so we follow similar approach. -&amp;gt; rename to temp folder and rename it back again&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Rename-Item Home homes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;commit the changes and again run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Rename-Item homes home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and finally push your changes.&lt;/p&gt;

&lt;p&gt;We run webpack so sometimes it caches the build so have to run a build for prod and then again switch back to the local dev build.&lt;/p&gt;

</description>
      <category>git</category>
    </item>
    <item>
      <title>Common Git commands</title>
      <dc:creator>Prayatna Bhattarai</dc:creator>
      <pubDate>Tue, 01 Dec 2020 06:37:50 +0000</pubDate>
      <link>https://dev.to/studentedge/common-git-commands-68a</link>
      <guid>https://dev.to/studentedge/common-git-commands-68a</guid>
      <description>&lt;p&gt;Few of the git command that we use at Student Edge:&lt;/p&gt;

&lt;h4&gt;
  
  
  Pulling from origin (note: master below can be replaced by any branch name)
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;git pull --rebase origin master&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Switching to an existing branch
&lt;/h4&gt;

&lt;p&gt;If you already have the branch locally you can just do&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git checkout MyOtherBranch&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;if you don't have the branch locally you need to do the following&lt;br&gt;
&lt;/p&gt;

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

git checkout -b MyOtherBranch remotes/origin/MyOtherBranch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Creating a new branch
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;git checkout -b MyNewBranch&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Pushing your branch to origin
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;git push origin MyBranch&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Commit your code to your current branch.
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add --all :/

git commit -m 'WR-123 I changed something'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Make a tweak to your previous commit
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;git commit --amend&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After running the above it will open vim. Just type &lt;code&gt;:wq&lt;/code&gt; and it will rebase and commit it&lt;/p&gt;

&lt;h4&gt;
  
  
  Remove a commit from your branch (note: the hats are how many commits to go back)
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;git rebase -i HEAD^^&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After running this it will open vim with all the commits listed, the number of &lt;code&gt;^&lt;/code&gt; will indicate how many commits it will show. Type &lt;code&gt;i&lt;/code&gt; which will put it in edit mode. Delete the commit lines you want to remove. Then press &lt;code&gt;Esc&lt;/code&gt; and then &lt;code&gt;:rw&lt;/code&gt; to rebase.&lt;/p&gt;

&lt;p&gt;Thanks to &lt;a href="http://danielvanheerden.com/my-gitconfig/"&gt;Dan&lt;/a&gt;, you can add this helper git file in the root of your user account folder (eg. C:\users\'myUser') and create your own git shortcuts (.gitconfig)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[user]name = Your user name
email = your@email.com

[alias]# Pretty text base branch tree
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)&amp;lt;%an&amp;gt;%Creset' --abbrev-commit --date=relative

# When on master branch, force local master to be the same as origin
refreshmaster = checkout    -B master remotes/origin/master

# pretty diff of changes
diff = diff --word-diff=color

# After Fixing conflicts - OK to proceed with rebase
ok = rebase --continue

# Push the current branch upstream to it's namesake branch on origin
up = push origin HEAD

# Push the current branch upstream to it's namesake branch on origin with FORCE
upf = push -f origin HEAD

# Replace NEW stuff from master to my current branch
new = pull --rebase origin master

# Track all new changes
done = add --all :/

# Amend my last commit - request you to do "git add --all :/" or "done" first and then do `:wq` in vim to save and rebase
tweak = commit --amend

# Give a list of the last branches on my local git
lb = for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/
changes = diff-tree --no-commit-id --name-only -r 

[push]
default = upstream
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>git</category>
    </item>
    <item>
      <title>How to remove local branches that have been closed on master</title>
      <dc:creator>Prayatna Bhattarai</dc:creator>
      <pubDate>Mon, 23 Nov 2020 06:20:36 +0000</pubDate>
      <link>https://dev.to/studentedge/how-to-remove-local-branches-that-have-been-closed-on-master-3pnk</link>
      <guid>https://dev.to/studentedge/how-to-remove-local-branches-that-have-been-closed-on-master-3pnk</guid>
      <description>&lt;p&gt;In Git Bash/ Git CLI run the commands as follow (from whichever branch you are currently on):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;git remote prune origin
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;checkout master&lt;/li&gt;
&lt;li&gt;update it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and run in Git Bash/ Git CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git branch --merged | grep -v "\*" | xargs -n 1 git branch -
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's it!&lt;/p&gt;

&lt;p&gt;To delete all local branches except master:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git branch | grep -v "master" | xargs git branch -D
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Some commands to a further clean up: &lt;a href="http://everydayrails.com/2014/02/27/git-reset-clean.html"&gt;Git clean&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
    </item>
  </channel>
</rss>
