{"componentChunkName":"component---node-modules-gatsby-theme-document-src-templates-docs-js","path":"/git","result":{"data":{"mdx":{"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"Git\",\n  \"description\": \"This is the meta description for this page\"\n};\n\nvar makeShortcode = function makeShortcode(name) {\n  return function MDXDefaultShortcode(props) {\n    console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n    return mdx(\"div\", props);\n  };\n};\n\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, [\"components\"]);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(Message, {\n    variant: \"important\",\n    mdxType: \"Message\"\n  }, \"\\uD83D\\uDD14\\uFE0F \", mdx(\"b\", null, \"Important\"), \" \", mdx(\"br\", null), \"It is assumed that you are issuing all the \", mdx(\"strong\", null, \"Git\"), \" commands from the \", mdx(\"strong\", null, \"root\"), \" directory of your project.\"), mdx(\"p\", null, \"Below are shown the most common git commands. To see these commands in use in real case scenarios, move down to the section \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"#ordinary-operations\"\n  }), \"Ordinary operations\"), \". \"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"git init\"), \": Create a new \", mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"git\"), \" repository in the curren directory.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"git status\"), \": Checks which files have changed in the working directory and are ready to be added to the staging area.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"git checkout \", \"[file]\"), \": Remove last edits on the file in the working directory so the file does not appear when running \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"git status\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"git add \", \"[file]\"), \": Adds the selected changed files or all changed files (\", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"git add .\"), \") from the working directory to the staging area.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"git reset HEAD \", \"[file]\"), \": Removes file from the staging area.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"git commit\"), \": Add files to the local respository by making a snapshot of the of the current state of the directory as per files added in the staging area.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"git reset --soft HEAD^\"), \": Removes file from the local repository and puts it again in the staging area.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"git push\"), \": Pushes the new commits in the local repository to the remote repository.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"git pull\"), \": Pulls the remote repository commits into the local repository. It's a way to update the local repository.\")), mdx(\"h3\", {\n    \"id\": \"ordinary-operations\"\n  }, \"Ordinary operations\"), mdx(\"h4\", {\n    \"id\": \"creating-a-remote-repository-in-github\"\n  }, \"Creating a remote repository in GitHub:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", _extends({\n    parentName: \"li\"\n  }, {\n    \"href\": \"https://help.github.com/en/github/getting-started-with-github/create-a-repo\"\n  }), \"Create a repository\"), \" on \", mdx(\"em\", {\n    parentName: \"li\"\n  }, \"GitHub\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Then move to the root directory of your local project and download this \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \".gitignore\"), \" file:\", mdx(\"ul\", {\n    parentName: \"li\"\n  }, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"For \", mdx(\"a\", _extends({\n    parentName: \"li\"\n  }, {\n    \"href\": \"https://drive.google.com/file/d/1Gjd28wj7tGGPjzh0JFAy3LNhOZovSG5r/view?usp=sharing\"\n  }), \"Gatsby\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"For \", mdx(\"a\", _extends({\n    parentName: \"li\"\n  }, {\n    \"href\": \"https://drive.google.com/file/d/17PUFFPg2N5r4xaguBbtooMIu7LFI35JE/view?usp=sharing\"\n  }), \"React\"))))), mdx(\"h4\", {\n    \"id\": \"creating-a-new-local-repository\"\n  }, \"Creating a new local repository\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {}), \"git init\\ngit add .\\ngit commit -m 'first commit'\\ngit branch -M main\\ngit remote add origin https://github.com/mygitaccount/myrepository.git\\ngit push -u origin master\\n\")), mdx(\"h4\", {\n    \"id\": \"updating-remote-repository\"\n  }, \"Updating remote repository\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {}), \"git add . # or git add -A\\ngit commit -m 'changed some stuff'\\ngit push\\n\")), mdx(\"h4\", {\n    \"id\": \"updating-local-repository-from-remote-repository\"\n  }, \"Updating local repository from remote repository\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {}), \"$ git pull\\n\")), mdx(\"h4\", {\n    \"id\": \"get-information-about-the-remote-repository\"\n  }, \"Get information about the remote repository\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {}), \"git remote -v\\ngit remote show origin\\ngit config --get remote.origin.url\\n\")), mdx(\"p\", null, \"If there are several machines working with local respositories from a common remote repositories, before pushing to the remote repository from one of the local repositories, we must pull the information from the remote repository, as it may have changed due to another machine pushing changes to it.\"), mdx(\"h4\", {\n    \"id\": \"push-an-existing-repository-from-the-command-line\"\n  }, \"Push an existing repository from the command line\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {}), \"git remote add origin https://github.com/mygitaccount/myrepository.git\\ngit branch -M main\\ngit push -u origin main\\n\")), mdx(\"h3\", {\n    \"id\": \"other-operations\"\n  }, \"Other operations\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Cloning a remote repository: \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"git clone https://github.com/mygitaccount/myrepository.git\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"See what you haven't git added yet: \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"git diff [filename]\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"See what you have git added already: \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"git diff --cached [filename]\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"See list of files commited and ready to be pushed: \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"git diff --cached --stat origin/master\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"See differences between working directory and local repository: \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"git diff HEAD\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"See differences between local repository and remote repository: \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"git diff master origin/master\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"See commits historical: \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"git log\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"See modified files in each commit: \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"git log --stat\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"See changes in a commit: \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"git show [commit]\"))), mdx(\"h3\", {\n    \"id\": \"useful-commands\"\n  }, \"Useful commands\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Edit last commit (edit or add new file to last commit): \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"git commit --amend\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Setting your Git username for every repository in your computer:\\n\", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"$ git config --global user.name \\\"John Doe\\\"\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Set your commit email address in Git:\\n\", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"git config --global user.email \\\"email@example.com\\\"\"), \" \")), mdx(\"h2\", {\n    \"id\": \"cloning-vs-pulling\"\n  }, \"Cloning vs Pulling\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Cloning\"), \" will download the whole GitHub repository to your local machine. You can now either start a new project with that repository or you can collaborate with that repository:\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"If you want to start a new project, you must delete the \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \".git\"), \" directory (to remove the original remote push repository). You then can \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"git init\"), \" and add a different new remote repository.\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"If you want to collaborate, you just keep the \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \".git\"), \" directory and push normally.\")), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Pulling\"), \" will download only the updated information of the GitHub repository in relation to your local repository. You will \", mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"push\"), \" to the original remote repository afterward. \"), mdx(\"h2\", {\n    \"id\": \"branches\"\n  }, \"Branches\"), mdx(\"p\", null, \"Branching means you diverge from the main line of development and continue to do work \", mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"without messing\"), \" with that main line.\"), mdx(\"h4\", {\n    \"id\": \"creating-a-new-branch\"\n  }, \"Creating a new branch\"), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"$ git branch testing\")), mdx(\"h4\", {\n    \"id\": \"listing-branches\"\n  }, \"Listing branches\"), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"$ git branch -a\")), mdx(\"h4\", {\n    \"id\": \"show-where-the-branch-pointers-head-are-pointing\"\n  }, \"Show where the branch pointers (\", mdx(\"inlineCode\", {\n    parentName: \"h4\"\n  }, \"HEAD\"), \") are pointing\"), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"$ git log --oneline --decorate\")), mdx(\"h4\", {\n    \"id\": \"switching-branches\"\n  }, \"Switching Branches\"), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"$ git checkout testing\")), mdx(\"p\", null, \"This moves \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"HEAD\"), \" to the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"testing\"), \" branch. All new commits from this point will only affect the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"testing\"), \" branch. If you switch back to \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"master\"), \" and commit from there, the commit will only affect \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"master\"), \". You have diverted your project in two separated branches.'\"), mdx(Message, {\n    variant: \"important\",\n    mdxType: \"Message\"\n  }, \"\\uD83D\\uDD14\\uFE0F \", mdx(\"b\", null, \"Important\"), \" \", mdx(\"br\", null), \"For the new branch to be fully separated from the master branch, you must \", mdx(\"strong\", null, \"commit\"), \" the changes in the new branch.\"), mdx(\"h4\", {\n    \"id\": \"merging-branches\"\n  }, \"Merging branches\"), mdx(\"p\", null, \"Move to the master branch and then merge with testing branch:\"), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"$ git checkout master\")), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"$ git merge testing\")), mdx(\"p\", null, \"You can delete now testing branch:\"), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"$ git branch -d testing\")), mdx(\"h4\", {\n    \"id\": \"see-merged-branches\"\n  }, \"See merged branches\"), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"git branch --merged\")), mdx(\"h4\", {\n    \"id\": \"deleting-branches\"\n  }, \"Deleting branches\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Local: \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"$ git branch -d testing\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Remote: \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"$ git push origin --delete testing\"))), mdx(\"h3\", {\n    \"id\": \"branches-workflow\"\n  }, \"Branches Workflow\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {}), \"git branch newbranch\\ngit checkout newbranch\\n[edit existing file/s or create new file/s]\\n[git add and git commit]\\ngit push -u origin newbranch\\n[edit, add, commit and push to origin newbranch as needed]\\ngit checkout master\\ngit pull origin master\\ngit merge newbranch\\ngit push origin master\\n\")), mdx(\"h1\", {\n    \"id\": \"ssh-to-github\"\n  }, \"SSH to GitHub\"), mdx(\"p\", null, \"With SSH keys, you can connect to GitHub without supplying your username or password at each visit. You'll need to perfom the steps below for each computer you intend to use to connect to your GitHub repository.\"), mdx(\"h4\", {\n    \"id\": \"generating-new-ssh-adding-it-to-ssh-agent-and-setting-ssh-url-to-repo\"\n  }, \"Generating new SSH, adding it to SSH agent and setting SSH URL to repo\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Checking for existing SSH keys:\")), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"ls -al ~/.ssh\")), mdx(\"p\", null, \"If there is no results, generate a new SSH key.\"), mdx(\"ol\", {\n    \"start\": 2\n  }, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Generate the SSH key, substituting in your GitHub email address:\")), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"$ ssh-keygen -t rsa -b 4096 -C \\\"your_email@example.com\\\"\")), mdx(\"ol\", {\n    \"start\": 3\n  }, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"(Optional) Start the ssh-agent in the background:\")), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"eval \\\"$(ssh-agent -s)\\\"\")), mdx(\"ol\", {\n    \"start\": 4\n  }, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"(Optional) Add key to ssh-agent:\")), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"$ ssh-add ~/.ssh/id_rsa\")), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Note\"), \": Steps 3 and 4 are optional, because the \", mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"ssh-agent\"), \" is used to store passphrase if you choose to create a passphrase while creating the SSH key. This way you only need to enter the passphrase once.\"), mdx(\"h4\", {\n    \"id\": \"adding-a-new-ssh-key-to-your-github-account\"\n  }, \"Adding a new SSH key to your GitHub account\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Open your \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"~/.ssh/id_rsa.pub\"), \" file and copy the content\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Go to GitHub \\u27A1\\uFE0F Settings \\u27A1\\uFE0F SSH and GPG keys \\u27A1\\uFE0F New SSH key\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Paste the SSH key into the 'Key' field. Add a descriptive label for the 'Title' field.\")), mdx(\"h3\", {\n    \"id\": \"switching-remote-urls-from-https-to-sshssh-to-https\"\n  }, \"Switching remote URLs from HTTPS to SSH/SSH to HTTPS\"), mdx(\"p\", null, \"HTTPS TO SSH\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {}), \"$ git remote set-url origin git@github.com:mygitaccount/myrepository.git\\n\")), mdx(\"p\", null, \"SSH TO HTTPS\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {}), \"$ git remote set-url origin https://git@github.com:mygitaccount/myrepository.git\\n\")), mdx(\"p\", null, \"Verify that the remote URL has changed: \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"$ git remote -v\")), mdx(\"p\", null, \"More info at \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"https://help.github.com/en/github/using-git/changing-a-remotes-url\"\n  }), \"GitHub\"), \".\"), mdx(\"h2\", {\n    \"id\": \"two-factor-authentication\"\n  }, \"Two-factor authentication\"), mdx(\"p\", null, \"If you have enabled two-factor authentication in your GitHub account, you must create a Security Key in order to operate from the GitHub repository when using \", mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"https\"), \". The steps belows only need to be performed once. The security key will work in any computer you use to connect to your GitHub account, as long as you know what is the security key.\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Go to GitHub \\u27A1\\uFE0F Settings \\u27A1\\uFE0F Developer settings \\u27A1 Personal access tokens \\u27A1 Generate new token\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"In the new page that loads, check the \", mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"repo\"), \" scope checkbox and type a meaningful note in the \", mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"note\"), \" text box.\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Click on \", mdx(\"em\", {\n    parentName: \"li\"\n  }, \"'Generate token'\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Copy the new generated personal access token in a secure location because you won't be able to see it again.\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"When you clone a repository, you will be prompted to type the username. Type the personal access token.\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"When prompted to type the password, leave it blank and press \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"Enter\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"From that point on, you will operate without adding any credential. \")), mdx(\"h1\", {\n    \"id\": \"bare-git-repository\"\n  }, \"Bare Git repository\"), mdx(\"p\", null, \"Bare Git repositories are great to keep all your \", mdx(\"em\", {\n    parentName: \"p\"\n  }, \"dotfiles\"), \" aka \", mdx(\"em\", {\n    parentName: \"p\"\n  }, \"config files\"), \" in a repository. This way, if you reinstall the operating system again, you can clone the bare repository and have all the config files ready.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {}), \"git init --bare $HOME/.cfg\\necho \\\"alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'\\\" >> $HOME/.bashrc\\nconfig config --local status.showUntrackedFiles no\\n\")), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"The first line creates a folder \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"~/.cfg\"), \" which is a Git bare repository that will track our files.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Then we create an alias config which we will use instead of the regular git when we want to interact with our configuration repository.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"We set a flag - local to the repository - to hide files we are not explicitly tracking yet. This is so that when you type config status and other commands later, files you are not interested in tracking will not show up as untracked.\")), mdx(\"h3\", {\n    \"id\": \"usage\"\n  }, \"Usage\"), mdx(\"p\", null, \"For this bare repository, instead of using the command \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"git\"), \", we use the command \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"config\"), \".\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {}), \"config add .bashrc\\nconfig commit -m 'created .bashrc'\\nconfig remote add origin https://github.com/mygitaccount/myrepository.git\\nconfig push -u origin master\\n\")), mdx(Message, {\n    variant: \"important\",\n    mdxType: \"Message\"\n  }, \"\\uD83D\\uDD14\\uFE0F \", mdx(\"b\", null, \"Important\"), \" \", mdx(\"br\", null), \"DO NOT use \", mdx(\"strong\", null, \"config add .\"), \" or \", mdx(\"strong\", null, \"config add -A\"), \". Always specify the files/directories you want to add. Otherwise you will add the whole directories and files configured with the `--work-tree` parameter.\"));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"items":[{"items":[{"url":"#ordinary-operations","title":"Ordinary operations","items":[{"url":"#creating-a-remote-repository-in-github","title":"Creating a remote repository in GitHub:"},{"url":"#creating-a-new-local-repository","title":"Creating a new local repository"},{"url":"#updating-remote-repository","title":"Updating remote repository"},{"url":"#updating-local-repository-from-remote-repository","title":"Updating local repository from remote repository"},{"url":"#get-information-about-the-remote-repository","title":"Get information about the remote repository"},{"url":"#push-an-existing-repository-from-the-command-line","title":"Push an existing repository from the command line"}]},{"url":"#other-operations","title":"Other operations"},{"url":"#useful-commands","title":"Useful commands"}]},{"url":"#cloning-vs-pulling","title":"Cloning vs Pulling"},{"url":"#branches","title":"Branches","items":[{"items":[{"url":"#creating-a-new-branch","title":"Creating a new branch"},{"url":"#listing-branches","title":"Listing branches"},{"url":"#show-where-the-branch-pointers-head-are-pointing","title":"Show where the branch pointers (HEAD) are pointing"},{"url":"#switching-branches","title":"Switching Branches"},{"url":"#merging-branches","title":"Merging branches"},{"url":"#see-merged-branches","title":"See merged branches"},{"url":"#deleting-branches","title":"Deleting branches"}]},{"url":"#branches-workflow","title":"Branches Workflow"}]}]},{"url":"#ssh-to-github","title":"SSH to GitHub","items":[{"items":[{"items":[{"url":"#generating-new-ssh-adding-it-to-ssh-agent-and-setting-ssh-url-to-repo","title":"Generating new SSH, adding it to SSH agent and setting SSH URL to repo"},{"url":"#adding-a-new-ssh-key-to-your-github-account","title":"Adding a new SSH key to your GitHub account"}]},{"url":"#switching-remote-urls-from-https-to-sshssh-to-https","title":"Switching remote URLs from HTTPS to SSH/SSH to HTTPS"}]},{"url":"#two-factor-authentication","title":"Two-factor authentication"}]},{"url":"#bare-git-repository","title":"Bare Git repository","items":[{"items":[{"url":"#usage","title":"Usage"}]}]}]},"frontmatter":{"title":"Git","description":"This is the meta description for this page"}}},"pageContext":{"isCreatedByStatefulCreatePages":false,"id":"9aea2218-07e9-5d5e-9a52-ecf553a0ca2b"}}}