<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Alperen Doc</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/</link><description>Recent content on Alperen Doc</description><generator>Hugo</generator><language>en</language><atom:link href="https://blog.ulutasalperen.com/docs/version_control_systems/index.xml" rel="self" type="application/rss+xml"/><item><title>basic_git_conf</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/basic_git_conf/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/basic_git_conf/</guid><description>&lt;p&gt;Git username &amp;amp; git email conf&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git config --add --global user.name &lt;span style="color:#e6db74"&gt;&amp;#34;github_username_here&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git config --add --global user.email &lt;span style="color:#e6db74"&gt;&amp;#34;email@example.com&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Git github default branc&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git config --global init.defaultBranch main&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;CLI ile login ol&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;gh auth login&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>basic_git_knowledge</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/basic_git_knowledge/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/basic_git_knowledge/</guid><description>&lt;h1 id="simplified-git-commands-guide"&gt;Simplified Git Commands Guide&lt;a class="anchor" href="#simplified-git-commands-guide"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;h2 id="initialize-a-git-repository"&gt;Initialize a Git Repository&lt;a class="anchor" href="#initialize-a-git-repository"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Navigate to the directory you want to track.&lt;/li&gt;&#10;&lt;li&gt;Run the following command:&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git init&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="adding-files-or-directories"&gt;Adding Files or Directories&lt;a class="anchor" href="#adding-files-or-directories"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;To add files or directories to the staging area, use:&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git add &amp;lt;file_or_directory_name&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="git-add/"&gt;git add&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="checking-the-current-state"&gt;Checking the Current State&lt;a class="anchor" href="#checking-the-current-state"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;To see the current state of your repository:&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git status&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="git-status/"&gt;git status&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="committing-changes"&gt;Committing Changes&lt;a class="anchor" href="#committing-changes"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;To save changes to the repository:&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git commit -m &lt;span style="color:#e6db74"&gt;&amp;#34;Your commit message&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="git-commit/"&gt;git commit&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="branch-management"&gt;Branch Management&lt;a class="anchor" href="#branch-management"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;h3 id="creating-and-switching-to-a-new-branch"&gt;Creating and Switching to a New Branch&lt;a class="anchor" href="#creating-and-switching-to-a-new-branch"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Use the following command to create and switch to a new branch:&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git switch -c my_new_branch&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;This is easier than using &lt;code&gt;git branch&lt;/code&gt; followed by &lt;code&gt;git switch&lt;/code&gt;.&lt;/em&gt; &lt;a href="git-branch/"&gt;git branch&lt;/a&gt;&lt;/p&gt;</description></item><item><title>github_workflow</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/github_workflow/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/github_workflow/</guid><description>&lt;p&gt;001 - &lt;a href="continuous_integration/"&gt;continuous_integration&lt;/a&gt;&#10;002 - &lt;a href="continuous_deployment/"&gt;continuous_deployment&lt;/a&gt;&lt;/p&gt;&#10;&lt;h1 id="hugo-book-teması-ve-github-actionsworkflow-ile-vpse-cd"&gt;Hugo-Book Teması ve GitHub Actions(workflow) ile VPS&amp;rsquo;e CD&lt;a class="anchor" href="#hugo-book-temas%c4%b1-ve-github-actionsworkflow-ile-vpse-cd"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;Hugo,Markdown dosyalarını statik bir siteye dönüştüren bir araç. Bu yazıda, suan bulundugunuz siteyi nasil &lt;em&gt;hugo-book&lt;/em&gt; temasını kullanırken aynı zamanda GitHub Workflow kullanarak her değişikliği debian tabanli uzak sunucuma nasıl otomatik olarak deploy edeceğimi anlatmak istedim.&lt;/p&gt;&#10;&lt;h2 id="1-vps-ve-kullanıcı-yapılandırması"&gt;1. VPS ve Kullanıcı Yapılandırması&lt;a class="anchor" href="#1-vps-ve-kullan%c4%b1c%c4%b1-yap%c4%b1land%c4%b1rmas%c4%b1"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;İlk başta sistemi &lt;code&gt;--system&lt;/code&gt; parametresiyle kurmayı düşünmüştüm. Sistem kullanıcısı oluşturmak mantıklı çünkü bu kullanıcının varsayılan olarak bir şifresi ve interaktif bir shell oturumu olmaz (tabi belirli komutlarla yapilabilir). Bu da sunucunun guvenligini arttirir.&lt;/p&gt;</description></item><item><title>continuous_integration</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/continuous_integration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/continuous_integration/</guid><description>&lt;h1 id="continuous-integration"&gt;Continuous Integration&lt;a class="anchor" href="#continuous-integration"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;Continuous Integration (CI) is where developers regularly push code changes into a central repository, and by doing so, automated builds and tests are automatically run.&lt;/p&gt;&#10;&lt;p&gt;Those tests can include unit tests, integration tests, styling checks, linting checks, security checks or any other type of automated test. If &lt;em&gt;any&lt;/em&gt; of the tests fail, the build is considered &amp;ldquo;broken&amp;rdquo; and the developer is notified so they can fix it.&lt;/p&gt;&#10;&lt;h2 id="i-was-forked-bootdev-cli-for-testing-ci-at-bootdev-cli"&gt;I was forked boot.dev cli for testing CI at Boot.dev Cli&lt;a class="anchor" href="#i-was-forked-bootdev-cli-for-testing-ci-at-bootdev-cli"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Here at Boot.dev CI tests that run each time a new pull request is opened. The reviewer doesn&amp;rsquo;t need to manually check for formatting issues or run tests locally before approving the changes. It automates &lt;em&gt;part&lt;/em&gt; of the code review process.&lt;/p&gt;</description></item><item><title>continuous_deployment</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/continuous_deployment/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/continuous_deployment/</guid><description>&lt;p&gt;Continuous Deployment (CD) is the process of automatically deploying code changes to a production environment after the code has been built and tested. Let&amp;rsquo;s set up CD for Notely!&lt;/p&gt;&#10;&lt;p&gt;We&amp;rsquo;ll be using GitHub Actions again, but we&amp;rsquo;ll create a new workflow for CD: &lt;code&gt;cd.yml&lt;/code&gt;&lt;/p&gt;&#10;&lt;h2 id="how-to-create-cd"&gt;How to create cd&lt;a class="anchor" href="#how-to-create-cd"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Create a new workflow &lt;code&gt;.github/workflows/cd.yml&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;It should trigger on &lt;code&gt;push&lt;/code&gt; into the &lt;code&gt;main&lt;/code&gt; branch.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;on&lt;/span&gt;:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;push&lt;/span&gt;:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;branches&lt;/span&gt;: [&lt;span style="color:#ae81ff"&gt;main]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start="3"&gt;&#10;&lt;li&gt;It should have a single job called &lt;code&gt;Deploy&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;It should checkout the code&lt;/li&gt;&#10;&lt;li&gt;It should set up the Go toolchain&lt;/li&gt;&#10;&lt;li&gt;It should build the app using the &lt;code&gt;scripts/buildprod.sh&lt;/code&gt; script&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;To be clear, the &lt;code&gt;ci&lt;/code&gt; workflow runs when a pull request is &lt;em&gt;opened&lt;/em&gt;, but the &lt;code&gt;cd&lt;/code&gt; workflow runs when a pull request is &lt;em&gt;merged&lt;/em&gt; (or when code is pushed directly to the &lt;code&gt;main&lt;/code&gt; branch).&lt;/p&gt;</description></item><item><title>git status</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/git-status/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/git-status/</guid><description>&lt;h1 id="status"&gt;Status&lt;a class="anchor" href="#status"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;A file can be in one of &lt;a href="https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#_the_very_basics"&gt;several states&lt;/a&gt; in a Git repository. Here are a few important ones:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;untracked&lt;/code&gt;: Not being tracked by Git&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;staged&lt;/code&gt;: Marked for inclusion in the next commit&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;committed&lt;/code&gt;: Saved to the repository&amp;rsquo;s history&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The &lt;code&gt;git status&lt;/code&gt; command shows you the current state of your repo. It will tell you which files are untracked, staged, and committed.&lt;/p&gt;&#10;&lt;p&gt;for more &lt;a href="git-branch/"&gt;git branch&lt;/a&gt;&lt;/p&gt;</description></item><item><title>git add</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/git-add/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/git-add/</guid><description>&lt;h1 id="git-add"&gt;git add&lt;a class="anchor" href="#git-add"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;Here&amp;rsquo;s the command:&lt;/p&gt;&#10;&lt;p&gt;&lt;code&gt;git add &amp;lt;path-to-file | pattern&amp;gt;&lt;/code&gt;&lt;/p&gt;&#10;&lt;p&gt;For example:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git add i-use-arch.btw&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>git commit</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/git-commit/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/git-commit/</guid><description>&lt;h1 id="commit"&gt;Commit&lt;a class="anchor" href="#commit"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;After staging a file, we can &lt;a href="https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/about-commits"&gt;commit&lt;/a&gt; it.&lt;/p&gt;&#10;&lt;p&gt;A commit is a snapshot of the repository at a given point in time. It&amp;rsquo;s a way to save the state of the repository, and it&amp;rsquo;s how Git keeps track of changes to the project. A commit comes with a message that describes the changes made in the commit.&lt;/p&gt;&#10;&lt;p&gt;Here&amp;rsquo;s how to &lt;a href="https://git-scm.com/docs/git-commit"&gt;commit&lt;/a&gt; all of your staged files:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git commit -m &lt;span style="color:#e6db74"&gt;&amp;#34;your message here&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id="change-the-last-commit-message"&gt;Change the last commit message&lt;a class="anchor" href="#change-the-last-commit-message"&gt;#&lt;/a&gt;&lt;/h4&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git commit --amend -m &lt;span style="color:#e6db74"&gt;&amp;#34;A: add contents.md&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>git push</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/git-push/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/git-push/</guid><description>&lt;h1 id="git-push"&gt;Git Push&lt;a class="anchor" href="#git-push"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;The &lt;code&gt;git push&lt;/code&gt; command pushes (sends) local changes to any &amp;ldquo;remote&amp;rdquo; - in our case, GitHub. For example, to push our local &lt;code&gt;main&lt;/code&gt; branch&amp;rsquo;s commits to the remote &lt;code&gt;origin&lt;/code&gt;&amp;rsquo;s &lt;code&gt;main&lt;/code&gt; branch we would run:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git push origin main&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;You need to be authenticated with the remote to push changes, which you should have done in the last lesson.&lt;/em&gt;&lt;/p&gt;&#10;&lt;h2 id="alternative-options"&gt;Alternative Options&lt;a class="anchor" href="#alternative-options"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;You can also push a local branch to a remote with a &lt;em&gt;different&lt;/em&gt; name:&lt;/p&gt;</description></item><item><title>git branch</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/git-branch/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/git-branch/</guid><description>&lt;h1 id="what-is-a-branch"&gt;What Is a Branch?&lt;a class="anchor" href="#what-is-a-branch"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;A &lt;a href="https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell"&gt;Git branch&lt;/a&gt; allows you to keep track of different changes separately.&lt;/p&gt;&#10;&lt;p&gt;For example, let&amp;rsquo;s say you have a big web project and you want to experiment with changing the color scheme. Instead of changing the entire project directly (as of right now, our &lt;code&gt;master&lt;/code&gt; branch), you can create a new branch called &lt;code&gt;color_scheme&lt;/code&gt; and work on that branch. When you&amp;rsquo;re done, if you like the changes, you can &lt;a href="https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging"&gt;merge&lt;/a&gt; the &lt;code&gt;color_scheme&lt;/code&gt; branch back into the &lt;code&gt;master&lt;/code&gt; branch to keep the changes. If you don&amp;rsquo;t like the changes, you can simply delete the &lt;code&gt;color_scheme&lt;/code&gt; branch and go back to the &lt;code&gt;master&lt;/code&gt; branch.&lt;/p&gt;</description></item><item><title>git pull</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/git-pull/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/git-pull/</guid><description>&lt;h1 id="pull"&gt;Pull&lt;a class="anchor" href="#pull"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;Fetching is nice, but most of the time we want the &lt;em&gt;actual file changes&lt;/em&gt; from a remote repo, not just the metadata.&lt;/p&gt;&#10;&lt;h2 id="command-syntax"&gt;Command Syntax&lt;a class="anchor" href="#command-syntax"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;code&gt;git pull [&amp;lt;remote&amp;gt;/&amp;lt;branch&amp;gt;]&lt;/code&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;The &lt;code&gt;[...]&lt;/code&gt; syntax means that the bracketed remote and branch are optional. If you execute git pull without anything specified it will pull your current branch from the remote repo&lt;/em&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="https://storage.googleapis.com/qvault-webapp-dynamic-assets/course_assets/gmj5WB9.png" alt="git pull origin main" /&gt;&lt;/p&gt;</description></item><item><title>git log</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/git-log/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/git-log/</guid><description>&lt;h1 id="git-log"&gt;Git Log&lt;a class="anchor" href="#git-log"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;A Git repo is a (potentially very long) list of commits, where each commit represents the &lt;em&gt;full state of the repository&lt;/em&gt; at a given point in time.&lt;/p&gt;&#10;&lt;p&gt;The &lt;a href="https://git-scm.com/docs/git-log"&gt;git log&lt;/a&gt; command shows a history of the commits in a repository. This is what makes Git a version control system. You can see:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Who made a commit&lt;/li&gt;&#10;&lt;li&gt;When the commit was made&lt;/li&gt;&#10;&lt;li&gt;What was changed&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="a-commit-hash"&gt;A Commit Hash&lt;a class="anchor" href="#a-commit-hash"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Each commit has a unique identifier called a &amp;ldquo;commit hash&amp;rdquo;. This is a long string of characters that uniquely identifies the commit. Here&amp;rsquo;s an example of mine:&lt;/p&gt;</description></item><item><title>git merge</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/git-merge/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/git-merge/</guid><description>&lt;h1 id="merge"&gt;Merge&lt;a class="anchor" href="#merge"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;&amp;ldquo;What&amp;rsquo;s the point of having multiple branches?&amp;rdquo; you might ask. They&amp;rsquo;re most often used to safely make changes without affecting your (or your &lt;em&gt;team&amp;rsquo;s&lt;/em&gt;) primary branch. However, once you&amp;rsquo;re happy with your changes, you&amp;rsquo;ll want to &lt;a href="https://git-scm.com/docs/git-merge"&gt;merge&lt;/a&gt; them back into the main branch so that they make their way into the final product.&lt;/p&gt;&#10;&lt;h2 id="visual"&gt;Visual&lt;a class="anchor" href="#visual"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Let&amp;rsquo;s say you&amp;rsquo;re in a state where you have two branches, each with their own unique commits:&lt;/p&gt;</description></item><item><title>git rebase</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/git-rebase/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/git-rebase/</guid><description>&lt;h1 id="rebase"&gt;Rebase&lt;a class="anchor" href="#rebase"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;&amp;ldquo;&lt;a href="https://git-scm.com/docs/git-rebase"&gt;Rebase&lt;/a&gt; vs &lt;a href="https://git-scm.com/docs/git-merge"&gt;Merge&lt;/a&gt;&amp;rdquo; is one of the most hotly debated topics in the Git world. A lot of the discussions you&amp;rsquo;ll see online come down to the fact that many developers (yes, even professionals) don&amp;rsquo;t understand the purpose of rebase and use it incorrectly, causing a bunch of Git havoc, and then blame the rebase command.&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;It&amp;rsquo;s not Git&amp;rsquo;s fault, it&amp;rsquo;s a skill issue.&lt;/em&gt;&lt;/p&gt;&#10;&lt;h2 id="visualizing-rebase"&gt;Visualizing Rebase&lt;a class="anchor" href="#visualizing-rebase"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Say we have this commit history:&lt;/p&gt;</description></item><item><title>git reset</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/git-reset/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/git-reset/</guid><description>&lt;h1 id="git-reset-soft"&gt;Git Reset Soft&lt;a class="anchor" href="#git-reset-soft"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;The &lt;a href="https://git-scm.com/docs/git-reset"&gt;git reset&lt;/a&gt; command can be used to undo the last commit(s) or any changes in the index (staged but not committed changes) and the worktree (unstaged and not committed changes).&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git reset --soft COMMITHASH&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;--soft&lt;/code&gt; option is useful if you just want to go back to a previous commit, but keep all of your changes. Committed changes will be uncommitted and staged, while uncommitted changes will remain staged or unstaged as before.&lt;/p&gt;</description></item><item><title>git remote</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/git-remote/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/git-remote/</guid><description>&lt;h1 id="git-remote"&gt;Git Remote&lt;a class="anchor" href="#git-remote"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;Often our frenemies (read: coworkers) make code changes that we need to begrudgingly accept into our pristine bug-free repos. &lt;em&gt;/s&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;This is where the &amp;ldquo;distributed&amp;rdquo; in &amp;ldquo;distributed version control system&amp;rdquo; comes from. We can have &amp;ldquo;remotes&amp;rdquo;, which are just external repos with &lt;em&gt;mostly&lt;/em&gt; the same Git history as our local repo.&lt;/p&gt;&#10;&lt;p&gt;When it comes to Git (the CLI tool), there really isn&amp;rsquo;t a &amp;ldquo;central&amp;rdquo; repo. GitHub is just someone else&amp;rsquo;s repo. Only by convention and convenience have we, as developers, started to use GitHub as a &amp;ldquo;source of truth&amp;rdquo; for our code.&lt;/p&gt;</description></item><item><title>git fetch</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/git-fetch/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/git-fetch/</guid><description>&lt;h1 id="fetch"&gt;Fetch&lt;a class="anchor" href="#fetch"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;Adding a remote to our Git repo does &lt;em&gt;not&lt;/em&gt; mean that we automagically have all the contents of the remote. First, we need to &lt;a href="https://git-scm.com/docs/git-fetch"&gt;fetch&lt;/a&gt; the contents (but not yet!).&lt;/p&gt;&#10;&lt;h2 id="command"&gt;Command&lt;a class="anchor" href="#command"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git fetch&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This downloads copies of all the contents of the &lt;code&gt;.git/objects&lt;/code&gt; directory (and other book-keeping information) from the remote repository into your current one.&lt;/p&gt;</description></item><item><title>git switch</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/git-switch/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/git-switch/</guid><description>&lt;h1 id="new-branch"&gt;New Branch&lt;a class="anchor" href="#new-branch"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;You should already be on the &lt;code&gt;main&lt;/code&gt; branch: your &amp;ldquo;default&amp;rdquo; branch. You can always check with &lt;code&gt;git branch&lt;/code&gt;.&lt;/p&gt;&#10;&lt;h2 id="two-ways-to-create-a-branch"&gt;Two Ways to Create a Branch&lt;a class="anchor" href="#two-ways-to-create-a-branch"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git branch my_new_branch&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This creates a new branch called &lt;code&gt;my_new_branch&lt;/code&gt;. The thing is, I rarely use this command because usually I want to create a branch and switch to it immediately. So I use this command instead:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git switch -c my_new_branch&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;a href="https://git-scm.com/docs/git-switch"&gt;switch&lt;/a&gt; command allows you to switch branches, and the &lt;code&gt;-c&lt;/code&gt; flag tells Git to create a new branch if it doesn&amp;rsquo;t already exist.&lt;/p&gt;</description></item><item><title>git config</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/git-config/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/git-config/</guid><description>&lt;p&gt;We need to configure Git to contain &lt;em&gt;your&lt;/em&gt; information. Whenever code changes, Git tracks &lt;em&gt;who&lt;/em&gt; made the change. To ensure you get proper credit (or more likely, blame) for all the code you write, you need to set your name and email.&lt;/p&gt;&#10;&lt;p&gt;Git comes with a &lt;a href="https://git-scm.com/docs/git-config"&gt;configuration&lt;/a&gt; both at the global and the repo (project) level. Most of the time, you&amp;rsquo;ll just use the global config.&lt;/p&gt;&#10;&lt;h2 id="assignment"&gt;Assignment&lt;a class="anchor" href="#assignment"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Let&amp;rsquo;s set your identity. Check if your &lt;code&gt;user.name&lt;/code&gt; and &lt;code&gt;user.email&lt;/code&gt; are already set:&lt;/p&gt;</description></item><item><title>gitignore</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/gitignore/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/gitignore/</guid><description>&lt;h1 id="gitignore"&gt;Gitignore&lt;a class="anchor" href="#gitignore"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;As you&amp;rsquo;ve seen, it&amp;rsquo;s &lt;em&gt;pretty normal&lt;/em&gt; to use the following workflow from the top level of your repo:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;code&gt;git add .&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;git commit -m &amp;quot;some message here&amp;quot;&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;git push origin main&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;A problem arises when we want to put files in our project&amp;rsquo;s directory, but we &lt;em&gt;don&amp;rsquo;t&lt;/em&gt; want to track them with Git. &lt;strong&gt;&lt;a href="gitignore/"&gt;gitignore&lt;/a&gt; file solves this.&lt;/strong&gt; For example, if you work with Python, you probably want to ignore automatically generated files like &lt;code&gt;.pyc&lt;/code&gt; and &lt;code&gt;__pycache__&lt;/code&gt;. If you are building a server, you probably want to ignore &lt;code&gt;.env&lt;/code&gt; files that might hold private keys. If you (I&amp;rsquo;m sorry) work with JavaScript, you might want to ignore the &lt;code&gt;node_modules&lt;/code&gt; directory.&lt;/p&gt;</description></item><item><title>plumping</title><link>https://blog.ulutasalperen.com/docs/version_control_systems/plumping/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/version_control_systems/plumping/</guid><description>&lt;h1 id="the-plumbing"&gt;The Plumbing&lt;a class="anchor" href="#the-plumbing"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;So far we&amp;rsquo;ve been using Git in a &amp;ldquo;porcelain&amp;rdquo; manner. But to sate our insatiable curiosity, let&amp;rsquo;s take a look at some of the &amp;ldquo;plumbing&amp;rdquo;.&lt;/p&gt;&#10;&lt;h2 id="its-just-files-all-the-way-down"&gt;It&amp;rsquo;s Just Files All the Way Down&lt;a class="anchor" href="#its-just-files-all-the-way-down"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;All the data in a Git repository is stored directly in the (hidden) &lt;code&gt;.git&lt;/code&gt; directory. That includes all the commits, branches, tags, and other objects we&amp;rsquo;ll learn about later.&lt;/p&gt;&#10;&lt;p&gt;Git is made up of &lt;a href="https://git-scm.com/book/en/v2/Git-Internals-Git-Objects"&gt;objects&lt;/a&gt; that are stored in the &lt;code&gt;.git/objects&lt;/code&gt; directory. A commit is just a type of object.&lt;/p&gt;</description></item></channel></rss>