<?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: Elaine Iheanacho </title>
    <description>The latest articles on DEV Community by Elaine Iheanacho  (@elaine_iheanacho).</description>
    <link>https://dev.to/elaine_iheanacho</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%2F1155744%2F33b38055-e22b-4edf-a929-d23ff9c8881c.png</url>
      <title>DEV Community: Elaine Iheanacho </title>
      <link>https://dev.to/elaine_iheanacho</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/elaine_iheanacho"/>
    <language>en</language>
    <item>
      <title>(Outdated) Complete Git Cheat sheet</title>
      <dc:creator>Elaine Iheanacho </dc:creator>
      <pubDate>Wed, 25 Sep 2024 08:20:06 +0000</pubDate>
      <link>https://dev.to/elaine_iheanacho/complete-git-cheat-sheet-3lbn</link>
      <guid>https://dev.to/elaine_iheanacho/complete-git-cheat-sheet-3lbn</guid>
      <description>&lt;p&gt;Navigating the complexities of version control can be a daunting task, so understanding Git is essential for efficient and collaborative software development. Git enables you to effectively manage code and collaborate seamlessly with other developers as well as many other functions.&lt;br&gt;
This Git cheat sheet is designed to be your quick reference guide, offering a concise reference for the essential commands and concepts in Git.&lt;/p&gt;

&lt;p&gt;This is not an introductory article. You must have at least a basic knowledge of Git and GitHub before proceeding to avoid confusion.&lt;/p&gt;

&lt;p&gt;If you happen to not be in the above category, visit my previous article, &lt;a href="https://dev.to/elaine-ui/introduction-to-git-and-github-2njb"&gt;introduction to Git and GItHub&lt;/a&gt;, and this YouTube playlist: &lt;a href="http://www.youtube.com/playlist?list=PL4cUxeGkcC9goXbgTDQ0n_4TBzOO0ocPR" rel="noopener noreferrer"&gt;Git and GitHub tutorial for beginners&lt;/a&gt; to get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  Git commands
&lt;/h2&gt;

&lt;p&gt;Here are the most frequently used Git commands:&lt;/p&gt;

&lt;p&gt;●Set Username:&lt;br&gt;
&lt;code&gt;git config __global user.name &amp;lt;desired username&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Set email:&lt;br&gt;
&lt;code&gt;git config __global user.email &amp;lt;desired email&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Go back a directory:&lt;br&gt;
&lt;code&gt;cd ..&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●List folder content:&lt;br&gt;
&lt;code&gt;Ls&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;OR &lt;br&gt;
&lt;code&gt;Dir&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Create a new directory:&lt;br&gt;
&lt;code&gt;mkdir &amp;lt;directory name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Create a new file inside a directory:&lt;br&gt;
&lt;code&gt;touch &amp;lt;file name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Open a file in text editor:&lt;br&gt;
&lt;code&gt;texteditorname &amp;lt;file name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Delete a file:&lt;br&gt;
&lt;code&gt;rm &amp;lt;file name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Delete a directory:&lt;br&gt;
&lt;code&gt;rmdir &amp;lt;directory name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Create a repository:&lt;br&gt;
Step 1: &lt;br&gt;
&lt;code&gt;cd &amp;lt;folder's full path&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Step 2: &lt;br&gt;
&lt;code&gt;git init&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Stage a file:&lt;br&gt;
&lt;code&gt;git add &amp;lt;file name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Stage all files:&lt;br&gt;
&lt;code&gt;git add .&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Check changed files/ files in or out of staging area:&lt;br&gt;
&lt;code&gt;git status&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Remove a file from staging area:&lt;br&gt;
&lt;code&gt;git rm __cached &amp;lt;file name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Create a commit:&lt;br&gt;
&lt;code&gt;git commit -m "&amp;lt;descriptive commit message&amp;gt;"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Check commit history:&lt;br&gt;
&lt;code&gt;git log&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;For a condensed version:&lt;br&gt;
&lt;code&gt;git log __oneline&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Check code of an earlier commit:&lt;br&gt;
&lt;code&gt;git checkout &amp;lt;commit's ID&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Undo a commit:&lt;br&gt;
&lt;code&gt;git revert &amp;lt;commit's ID&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Permanently go back to a commit:&lt;br&gt;
&lt;code&gt;git reset &amp;lt;commit's ID&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Note- the code remains in our text editor just in case, so to remove them:&lt;br&gt;
&lt;code&gt;git reset __hard&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Create a branch:&lt;br&gt;
&lt;code&gt;git branch &amp;lt;branch name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Go to a branch:&lt;br&gt;
&lt;code&gt;git checkout &amp;lt;branch name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Create and go the branch simultaneously:&lt;br&gt;
&lt;code&gt;git checkout -b&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Delete a branch:&lt;br&gt;
&lt;code&gt;git branch -D&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;for merged branches: &lt;br&gt;
&lt;code&gt;git branch -d&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Merge a branch:&lt;br&gt;
&lt;code&gt;git merge &amp;lt;branch name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Remove merged branch conflict:&lt;br&gt;
&lt;code&gt;:wq&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Push Git files to Github:&lt;br&gt;
&lt;code&gt;git push &amp;lt;github repository URL/ github repository URL alias&amp;gt; &amp;lt;branch name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Give a Github repository an alias:&lt;br&gt;
&lt;code&gt;git remote add &amp;lt;alias&amp;gt; &amp;lt;github repository URL&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Clone a Github repository into your computer:&lt;br&gt;
Step 1:&lt;br&gt;
&lt;code&gt;cd ..&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Step 2:&lt;br&gt;
&lt;code&gt;git clone &amp;lt;github repository URL&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Check your github repository URL:&lt;br&gt;
&lt;code&gt;git remote -v&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;●Make local repository up to date with remote repository:&lt;br&gt;
&lt;code&gt;git pull &amp;lt;github repository URL/ alias&amp;gt; &amp;lt;branch name&amp;gt;&lt;/code&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>github</category>
      <category>git</category>
      <category>beginners</category>
    </item>
    <item>
      <title>(Outdated) INTRODUCTION TO GIT AND GITHUB</title>
      <dc:creator>Elaine Iheanacho </dc:creator>
      <pubDate>Sat, 16 Sep 2023 20:00:05 +0000</pubDate>
      <link>https://dev.to/elaine_iheanacho/introduction-to-git-and-github-2njb</link>
      <guid>https://dev.to/elaine_iheanacho/introduction-to-git-and-github-2njb</guid>
      <description>&lt;p&gt;Outlines: &lt;br&gt;
●What is git?&lt;br&gt;
●Advantages of using git.&lt;br&gt;
●What is github?&lt;br&gt;
●Advantages of using github&lt;br&gt;
●How does git even work?&lt;/p&gt;

&lt;p&gt;Often, in programming, regrettable changes are made to our files. There is hesitation to experiment more with projects for fear that it might ruin what was originally planned. Reversing those changes back to the previous state might be too annoying and or time-consuming. Collaboration with other developers is stressful because file sharing can be bothersome, but not to worry, Git can fix all of that.&lt;/p&gt;

&lt;p&gt;What exactly is Git?&lt;br&gt;
According to Wikipedia, Git is a distributed version control system that tracks changes in any set of computer files, usually used for coordinating work among programmers who are collaboratively developing source code during software development. &lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/Git#:%7E:text=Git%20(/%C9%A1%C9%AAt/,source%20code%20during%20software%20development" rel="noopener noreferrer"&gt;https://en.wikipedia.org/wiki/Git#:~:text=Git%20(/%C9%A1%C9%AAt/,source%20code%20during%20software%20development&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In simpler terms, Git is a system that tracks changes to your files, allowing you to access any version of these files whenever you need. It also provides an environment that facilitates seamless collaboration with other developers on your project. &lt;br&gt;
What are the advantages of using Git?&lt;br&gt;
You might be thinking, "I go through my projects just fine with little to no issues, is there really a point to having Git?". There are numerous benefits you might not be aware of, a few of them are as follows:&lt;/p&gt;

&lt;p&gt;●Low storage: It helps store all the changes made to your file in one directory(folder), enabling you to save space on your computer.&lt;br&gt;
●Easy code management: Git provides a simple and effective way to manage code as it tracks all changes made to files making it easy to access any version of said file at any time.&lt;br&gt;
●Encourages experimentation: By leveraging Git, you can access any file and it's previous versions, and experiment with your code without the fear of losing the information or data.&lt;br&gt;
●Facilitates collaborative development: Git allows multiple developers to work on the same project with little to no issues.&lt;br&gt;
●Open source: It is freely available for anyone to use as it is an open-source project.&lt;/p&gt;

&lt;p&gt;What is Github?&lt;br&gt;
According to Wikipedia, it is a platform and cloud-based service for software development and version control using Git, allowing developers to store and manage their code.&lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/GitHub#:%7E:text=February%202023,store%20and%20manage%20their%20code" rel="noopener noreferrer"&gt;https://en.wikipedia.org/wiki/GitHub#:~:text=February%202023,store%20and%20manage%20their%20code&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In other words, github is an online platform that hosts and manages our work already saved to git.&lt;/p&gt;

&lt;p&gt;What are the advantages of using Github?&lt;br&gt;
Already having Git does not negate the need for Github, a few reasons being:&lt;br&gt;
●Collaboration: It makes collaboration easier as developers are able to work on the same code at the same time.&lt;br&gt;
●Easy sharing of code: Github facilitates easy sharing of code with other developers as it can host projects with the user's permission to be used by the public.&lt;br&gt;
●Security: Github ensures the user's code is protected from unauthorized access with its various security features.&lt;br&gt;
●Resolves issues: Github has a built-in feature that automatically tracks and resolves conflict in the code.&lt;/p&gt;

&lt;p&gt;How does Git work?&lt;br&gt;
The feature of Git used mainly by developers is the recording and storing of the changes made to their files, which sounds incredibly convenient, but how exactly does this happen? It is done by committing repositories.&lt;/p&gt;

&lt;p&gt;A repository is the folder containing the files to be tracked by Git. It is important to note that having various repositories saved to git won't merge or disturb your projects, regardless of how many repositories you have, they will all be tracked individually.&lt;br&gt;
Where the Git file resides significantly affects which files would be tracked.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F2n23ypg40orh88145pq0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F2n23ypg40orh88145pq0.jpg" alt=" " width="800" height="1260"&gt;&lt;/a&gt;&lt;br&gt;
In the above image, the git file is added to the main folder(project folder), so because of this, Git tracks all the items in the main folder, including the subfolder (IMG) and all the files in it. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fu4pngttshw7eu1fks7in.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fu4pngttshw7eu1fks7in.jpg" alt=" " width="800" height="1260"&gt;&lt;/a&gt;&lt;br&gt;
In the above image, the git file is added to the sub folder in the project folder(Javascript), so Git only tracks the files in the subfolder. The other files, as you can see, remain untouched by Git.&lt;/p&gt;

&lt;p&gt;A commit is a stage in your code saved to the repository that enables you to go to the saved stage whenever you please. You can think of commits as safe points in your project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fvbwd58ld8nix4q2d94aq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fvbwd58ld8nix4q2d94aq.jpg" alt=" " width="800" height="1096"&gt;&lt;/a&gt;&lt;br&gt;
In the above image, you can think of the boxes as commits and the line passing through them as code. The four boxes are all safe points you can jump back to whenever. If you feel like you don't want your footer anymore(Added footer), you can take a step back to the safe point before then(Change all fonts), and if you end up changing your mind about the footer again, no worries! Just jump back to the 'Added footer' commit, and you can have your footer back.&lt;br&gt;
There are three stages of committing: modified, staged, and committed.&lt;/p&gt;

&lt;p&gt;Modified: This is when you've changed or added to your code since the last safe point. &lt;br&gt;
Staged: By adding a file to the staging area, you choose or acknowledge a potential safe point to which you wish to be committed. Staged files are not the same as committed files; they are only files you're considering committing.&lt;br&gt;
Committed: By committing a staged file, you are officially crowning your current code as a safe point you can return to at any point you please.&lt;/p&gt;

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