<?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>Forem: Joel Hanerth</title>
    <description>The latest articles on Forem by Joel Hanerth (@joel_hanerth).</description>
    <link>https://forem.com/joel_hanerth</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%2F2091967%2Faa3e4f69-21f8-4d34-af43-76c4be9682f1.jpg</url>
      <title>Forem: Joel Hanerth</title>
      <link>https://forem.com/joel_hanerth</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/joel_hanerth"/>
    <language>en</language>
    <item>
      <title>Initial introduction to Git and github</title>
      <dc:creator>Joel Hanerth</dc:creator>
      <pubDate>Thu, 19 Sep 2024 14:41:57 +0000</pubDate>
      <link>https://forem.com/ledsifes/initial-introduction-to-git-and-github-4apc</link>
      <guid>https://forem.com/ledsifes/initial-introduction-to-git-and-github-4apc</guid>
      <description>&lt;p&gt;If you're a developer or just starting to program, you've probably heard of Git and GitHub. These tools are essential in the world of software development, especially for those working in teams or on open-source projects. But what exactly are they, and why are they so important?&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is Git?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Git is a distributed version control system created by Linus Torvalds in 2005. It allows developers to track changes in code, collaborate on different features, and revert changes when necessary. Git makes team collaboration easier since each developer can have their local copy of the repository and integrate their contributions into the main project in a controlled manner.&lt;br&gt;
Version control is also extremely useful for maintaining the project's history, enabling you to "go back in time" and see how the code evolved, or even revert to a previous state if something isn't working as expected.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;What is GitHub?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;GitHub is an online platform that hosts Git repositories. It adds a user-friendly interface and several extra features to collaborate with other developers. Besides storing repositories, GitHub offers tools such as pull requests, issues, and projects, making collaboration management and tracking bugs and new features easier.&lt;br&gt;
Another important point is that GitHub has become one of the main platforms for open-source development, allowing developers worldwide to collaborate on a wide variety of projects.&lt;br&gt;
With Git and GitHub, you not only have a powerful way to manage code locally but also a space to share your work and collaborate globally.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;How to create a repository on GitHub:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Access GitHub:&lt;/strong&gt; Log in to your GitHub account. If you don’t have an account, create one at &lt;a href="//github.com"&gt;github.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Create a new Repository:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In the upper-right corner of the screen, click the "+" icon and then click &lt;strong&gt;New repository&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftvgrs2v2vkhh7d5lv9i4.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftvgrs2v2vkhh7d5lv9i4.PNG" alt="Image description" width="800" height="72"&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxqunzj9sfh2pzkrk3h2p.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxqunzj9sfh2pzkrk3h2p.jpg" alt="Image description" width="800" height="76"&gt;&lt;/a&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Fill in the repository information:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Repository name:&lt;/strong&gt; Give your repository a name (for example, "my-project").
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Description (optional):&lt;/strong&gt; Add a brief description of the project.
&lt;/li&gt;
&lt;li&gt;Choose whether you want the repository to be &lt;strong&gt;Public&lt;/strong&gt; or &lt;strong&gt;Private&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can check the option to add a &lt;code&gt;README&lt;/code&gt; file if you want the repository to have an initial description.&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9f66rwjfaz4aj5g3zh3n.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9f66rwjfaz4aj5g3zh3n.jpg" alt="Image description" width="800" height="429"&gt;&lt;/a&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Create the Repository:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After filling in the details, click &lt;strong&gt;Create repository&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;GitHub will create the repository and show the repository URL, which you will use to clone it into your Visual Studio.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftn1t7ojyo970y4p5lbrg.jpg" alt="Image description" width="800" height="243"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Cloning the repository in Visual Studio&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now that you've created the repository on GitHub, you can clone it to your local machine and start working on it.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Steps to clone a repository in the Visual Studio terminal:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open Visual Studio.
&lt;/li&gt;
&lt;li&gt;Open the Integrated Terminal.
&lt;/li&gt;
&lt;li&gt;Navigate to the desired folder.
&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;git clone&lt;/code&gt; command:

&lt;ul&gt;
&lt;li&gt;In GitHub, copy the repository URL (HTTPS or SSH).
&lt;/li&gt;
&lt;li&gt;In Visual Studio's terminal, type the following command:
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   git clone &amp;lt;repository_url&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;5.Result:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Git will clone the repository into the current folder, and you'll see something like this in the terminal:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   Cloning into 'my-project'...
   remote: Counting objects: 100, done.
   remote: Compressing objects: 100% (XXX/XXX), done.
   Receiving objects: 100% (XXX/XXX), done.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;6.Navigate to the Cloned Repository:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, go to the folder of the cloned repository:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   cd my-project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;YOU’RE READY TO START!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you haven’t previously configured Git on your machine, you won’t be able to clone the repository successfully. Before trying the &lt;code&gt;git clone&lt;/code&gt; command, ensure Git is configured using the following commands in the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These commands configure the global username and email in your Git environment, which will be used when making commits. If Git isn’t configured, you may encounter errors when interacting with repositories.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's get to work!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now that you've cloned your repository, let's create a file, add it to version control, and explore Git's essential commands.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Creating a File and Using Basic Commands&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Create a file:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In Visual Studio, create a new file at the root of your project, for example, a file named &lt;code&gt;index.html&lt;/code&gt;. In the terminal, you can do this with the command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Or simply create the file in the Visual Studio editor.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Check the Repository Status:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To see what has changed in your repository, use the &lt;code&gt;git status&lt;/code&gt; command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Untracked files:
  (use "git add &amp;lt;file&amp;gt;..." to include in what will be committed)
      index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;This means Git has detected the &lt;code&gt;index.html&lt;/code&gt; file but is not tracking it yet.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;code&gt;git add&lt;/code&gt; Command&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;3. Add Files to Version Control:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To start tracking changes to a file, use the &lt;code&gt;git add&lt;/code&gt; command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If you want to add all modified or created files, you can use:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now the files are ready to be committed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;code&gt;git commit&lt;/code&gt; Command&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;4. Committing Changes:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A commit records changes to the repository. To create a commit, use the command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m "Adds index.html file"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The &lt;code&gt;-m&lt;/code&gt; flag allows you to add a descriptive message for the commit.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;code&gt;git log&lt;/code&gt; Command&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;5. Check Commit History:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To see the history of commits made in the repository, use the &lt;code&gt;git log&lt;/code&gt; command:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;This is the default log option, but Git offers some useful options to simplify and customize the &lt;code&gt;git log&lt;/code&gt; output.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Using &lt;code&gt;git log --oneline&lt;/code&gt;&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;oneline&lt;/strong&gt; mode compresses the display of commits into a single line per commit, showing only the short hash and commit message.
Command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  git log --oneline
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Using &lt;code&gt;git log --graph&lt;/code&gt;&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;git log --graph&lt;/code&gt; command displays the commits in a graph format, allowing you to visually see the structure of branches and merges.
Command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  git log --graph
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Combining &lt;code&gt;git log --graph --oneline --all&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can combine several options for a more comprehensive and simple view of the commit history. Combining &lt;code&gt;--graph&lt;/code&gt;, &lt;code&gt;--oneline&lt;/code&gt;, and &lt;code&gt;--all&lt;/code&gt; (which shows commits from all branches - you can know more about branches &lt;a href="https://dev.to/ledscolatina/introducao-sobre-branch-3pmn"&gt;here&lt;/a&gt;) is particularly useful for a clear view of the project's history.
Command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  git log --graph --oneline --all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output (example):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  * a1b2c3d (HEAD -&amp;gt; master) Adds new feature
  | * 9e8f7g6 (feature) Fixes bug in feature branch
  |/
  * 5h4i3j2 Refactors code for improvements
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;code&gt;git checkout&lt;/code&gt; Command&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This command has multiple uses, but I'll cover just two:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Revert Changes:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
If you make changes to a file and want to return to the last committed state, use the &lt;code&gt;git checkout&lt;/code&gt; command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;This will undo changes made to &lt;code&gt;index.html&lt;/code&gt; that haven't been committed yet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;7. View Project at a Specific Commit:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You can use the &lt;code&gt;git checkout&lt;/code&gt; command to "look" at how the project was at a particular commit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout [commit_hash]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Pushing and Updating the Remote Repository&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now that you've made local changes, you might want to push these changes to the remote repository (GitHub) or pull the latest changes someone else made in the repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;code&gt;git pull&lt;/code&gt; Command&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;8. Update Local Repository:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Before pushing your changes, it's a good practice to ensure your local copy is up to date with the remote repository. To do this, use:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;git pull&lt;/code&gt; command brings changes from the remote repository to your local machine.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;code&gt;git push&lt;/code&gt; Command&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;9. Push Your Changes to the Remote Repository:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, you can push your local commits to GitHub with the &lt;code&gt;git push&lt;/code&gt; command:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;This will push your changes to the &lt;code&gt;master&lt;/code&gt; or &lt;code&gt;main&lt;/code&gt; branch on the remote repository.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Did you like the post 🤔?  Are you interested in learning more about Git features? Visit: &lt;a href="https://dev.to/ledscolatina/introducao-sobre-branch-3pmn"&gt;Introduction to branch&lt;/a&gt; 😉&lt;/strong&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Introdução Inicial ao git</title>
      <dc:creator>Joel Hanerth</dc:creator>
      <pubDate>Thu, 19 Sep 2024 14:30:20 +0000</pubDate>
      <link>https://forem.com/ledscolatina/introducao-inicial-ao-git-5211</link>
      <guid>https://forem.com/ledscolatina/introducao-inicial-ao-git-5211</guid>
      <description>&lt;p&gt;Se você é desenvolvedor ou está começando a programar, provavelmente já ouviu falar de Git e GitHub. Essas ferramentas são essenciais no mundo do desenvolvimento de software, especialmente para quem trabalha em equipe ou em projetos de código aberto. Mas o que são exatamente e por que são tão importantes?&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;O que é Git?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;O Git é um sistema de controle de versão distribuído, criado por Linus Torvalds em 2005. Ele permite que desenvolvedores acompanhem o histórico de alterações no código, colaborem em diferentes funcionalidades e revertam mudanças quando necessário. O Git torna fácil trabalhar em equipe, já que cada desenvolvedor pode ter sua cópia local do repositório e integrar suas contribuições ao projeto principal de maneira controlada.&lt;br&gt;
O controle de versão também é extremamente útil para manter o histórico do projeto, possibilitando que você "volte no tempo" e veja como o código evoluiu, ou mesmo retorne a um estado anterior caso algo não esteja funcionando como esperado.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;O que é GitHub?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;O GitHub é uma plataforma online que hospeda repositórios Git. Ele adiciona uma interface amigável e várias funcionalidades extras para colaborar com outros desenvolvedores. Além de armazenar repositórios, o GitHub oferece ferramentas como pull requests, issues e projetos, que facilitam a gestão de colaborações e o acompanhamento de bugs e novas funcionalidades.&lt;br&gt;
Outro ponto importante é que o GitHub se tornou uma das principais plataformas para o desenvolvimento de código aberto, permitindo que desenvolvedores do mundo todo colaborem em uma enorme variedade de projetos.&lt;br&gt;
Com Git e GitHub, você não só tem uma maneira poderosa de gerenciar o código localmente, mas também um espaço para compartilhar seu trabalho e colaborar globalmente.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Como criar um repositório no GitHub:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Acesse o GitHub:&lt;/strong&gt; Entre na sua conta GitHub. Se você não tiver uma conta, crie uma em &lt;a href="//github.com"&gt;github.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Crie um novo Repositório:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No canto superior direito da tela, clique no ícone "+" e depois em New repository.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftvgrs2v2vkhh7d5lv9i4.PNG" alt="Image description" width="" height=""&gt;
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxqunzj9sfh2pzkrk3h2p.jpg" alt="Image description" width="" height=""&gt;
&lt;/li&gt;
&lt;li&gt;Preencha as informações do repositório:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Repository name:&lt;/strong&gt; Dê um nome ao seu repositório (por exemplo, "meu-projeto").&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Description (opcional):&lt;/strong&gt; Adicione uma breve descrição do projeto.&lt;/li&gt;
&lt;li&gt;Escolha se quer o repositório &lt;strong&gt;Público&lt;/strong&gt; ou &lt;strong&gt;Privado&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Você pode marcar a opção para adicionar um arquivo &lt;code&gt;README&lt;/code&gt; se quiser que o repositório tenha uma descrição inicial, além de servir como arquivo para anotar demandas.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9f66rwjfaz4aj5g3zh3n.jpg" alt="Image description" width="" height=""&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Crie o Repositório:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Após preencher as informações, clique em Create repository.&lt;/li&gt;
&lt;li&gt;O GitHub irá criar o repositório e mostrar a URL do repositório, que você usará para clonar no seu Visual Studio.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftn1t7ojyo970y4p5lbrg.jpg" alt="Image description" width="" height=""&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Clonando o repositório no visual studio&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Agora que você criou o repositório no GitHub, pode cloná-lo para sua máquina local e começar a trabalhar nele.&lt;br&gt;
&lt;strong&gt;Passos para clonar um repositório no terminal do Visual Studio:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Abra o Visual Studio:&lt;/li&gt;
&lt;li&gt;Abra o Terminal Integrado:&lt;/li&gt;
&lt;li&gt;Navegue até a Pasta Desejada:&lt;/li&gt;
&lt;li&gt;Use o Comando git clone:&lt;/li&gt;
&lt;li&gt;No GitHub, copie a URL do seu repositório (HTTPS ou SSH).&lt;/li&gt;
&lt;li&gt;No terminal do Visual Studio, digite o seguinte comando:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone &amp;lt;url_do_repositorio&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;5.Resultado:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;O Git irá clonar o repositório para a pasta atual, e você verá algo assim no terminal:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cloning into 'meu-projeto'...
remote: Counting objects: 100, done.
remote: Compressing objects: 100% (XXX/XXX), done.
Receiving objects: 100% (XXX/XXX), done.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;6.Acesse o Repositório Clonado:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Agora, navegue para a pasta do repositório clonado
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd meu-projeto
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;PRONTO, VOCÊ ESTÁ PRONTO PARA COMEÇAR!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Obs:&lt;/strong&gt; Caso você não tenha configurado o Git na sua máquina previamente, não será possível clonar o repositório com sucesso. Antes de tentar o comando git clone, certifique-se de configurar o Git usando os seguintes comandos no terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global user.name "Seu Nome"
git config --global user.email "seuemail@exemplo.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Esses comandos configuram o nome de usuário e o e-mail globalmente no seu ambiente Git, informações que serão usadas ao fazer commits. Se o Git não estiver configurado, você poderá enfrentar erros ao tentar interagir com repositórios.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mãos a massa!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Agora que você já clonou seu repositório, vamos criar um arquivo, adicionar ao controle de versão e explorar os comandos essenciais do Git.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Criando um Arquivo e usando comandos básicos&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Criar um arquivo:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No Visual Studio, crie um novo arquivo na raiz do seu projeto, por exemplo, um arquivo chamado &lt;code&gt;index.html&lt;/code&gt;. No terminal, você pode fazer isso com o comando:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Ou simplesmente crie o arquivo no próprio editor do Visual Studio.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Verificar o Status do Repositório:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Para ver o que mudou no seu repositório, use o comando &lt;code&gt;git status&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Untracked files:
  (use "git add &amp;lt;file&amp;gt;..." to include in what will be committed)
      index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Isso significa que o Git detectou o arquivo index.html, mas ainda não está rastreando-o.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Comando &lt;code&gt;git add&lt;/code&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;3. Adicionar Arquivos ao Controle de Versão:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Para começar a rastrear as mudanças em um arquivo, use o comando git add:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Se você quiser adicionar todos os arquivos modificados ou criados, pode usar:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Agora, os arquivos estão prontos para serem commitados.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Comando &lt;code&gt;git commit&lt;/code&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;4. Fazendo um Commit:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Um commit grava as alterações no repositório. Para criar um commit, use o comando:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m "Adiciona arquivo index.html"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;obs:&lt;/strong&gt; A flag -m permite adicionar uma mensagem descritiva para o commit.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Comando &lt;code&gt;git log&lt;/code&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;5. Verificar o Histórico de Commits:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Para ver o histórico dos commits feitos no repositório, use o comando git log:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Essa é a opção padrão do log, mas o Git oferece algumas opções úteis que você pode usar para simplificar e personalizar a saída do git log.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Usando &lt;code&gt;git log --oneline&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
-O modo &lt;strong&gt;oneline&lt;/strong&gt; compacta a exibição dos commits em uma única linha por commit, mostrando apenas o hash curto e a mensagem do commit.&lt;br&gt;
Comando:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log --oneline
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Usando &lt;code&gt;git log --graph&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;O comando &lt;code&gt;git log --graph&lt;/code&gt; exibe os commits em formato de gráfico, permitindo que você visualize visualmente a estrutura de branches e merges.
Comando:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log --graph
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Combinando &lt;code&gt;git log --graph --oneline --all&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Você pode combinar várias opções para uma visualização mais completa e simples do histórico de commits. A combinação de &lt;code&gt;--graph&lt;/code&gt;, &lt;code&gt;--oneline&lt;/code&gt;, e &lt;code&gt;--all&lt;/code&gt; (que mostra commits de todas as branches - você pode saber mais sobre brancher aqui) é particularmente útil para uma visualização clara da história do projeto.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Comando:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log --graph --oneline --all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Saída (exemplo):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* a1b2c3d (HEAD -&amp;gt; master) Adiciona nova funcionalidade
| * 9e8f7g6 (feature) Corrige erro na branch feature
|/
* 5h4i3j2 Refatora código para melhorias
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Comando &lt;code&gt;git checkout&lt;/code&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Esse comando serve para diversas ocasiões, mas irei abordar apenas duas:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6. Reverter Alterações:&lt;/strong&gt;&lt;br&gt;
Se você fizer alterações em um arquivo e quiser voltar para o último estado commitado, use o comando &lt;code&gt;git checkout&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Isso desfaz as mudanças feitas em &lt;code&gt;index.html&lt;/code&gt; que ainda não foram commitadas.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;7. Vê como estava o projeto commit x:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Você pode usar o comando &lt;code&gt;git checkout&lt;/code&gt; para "olhar" como estava o projeto em um determinado commit:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout [nº commit]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Enviando e Atualizando o Repositório Remoto&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Agora que você fez mudanças locais, pode querer enviar essas alterações para o repositório remoto (GitHub) ou trazer as alterações mais recentes que alguém fez no repositório.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Comando &lt;code&gt;git pull&lt;/code&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;8. Atualizando o Repositório Local:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Antes de enviar suas alterações, é uma boa prática garantir que sua cópia local está atualizada com o repositório remoto. Para isso, use:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;O &lt;code&gt;git pull&lt;/code&gt; traz as mudanças do repositório remoto para a sua máquina local.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Comando &lt;code&gt;git push&lt;/code&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;9. Enviando Suas Alterações para o Repositório Remoto:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Agora, você pode enviar seus commits locais para o GitHub com o comando &lt;code&gt;git push&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Isso enviará suas alterações para a branch master ou main no repositório remoto.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
