{"id":7,"date":"2022-08-09T10:19:14","date_gmt":"2022-08-09T10:19:14","guid":{"rendered":"https:\/\/devopssupport.in\/blog\/?p=7"},"modified":"2022-08-10T12:23:49","modified_gmt":"2022-08-10T12:23:49","slug":"what-is-git-and-github","status":"publish","type":"post","link":"https:\/\/www.devopssupport.in\/blog\/what-is-git-and-github\/","title":{"rendered":"WHAT IS GIT AND GITHUB ?"},"content":{"rendered":"\n<p>Git is&nbsp;a Developers tool which is use for source code management Git is&nbsp;a free and open source distributed version control system&nbsp;designed to manage any type of projects from small to very large projects with speed and efficiency. It is release on &nbsp;7 April 2005.<\/p>\n\n\n\n<p><strong>1. How to store repository in your local or clone?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git clone <em>paste HTTPS URL<\/em><\/code><\/pre>\n\n\n\n<p><strong>2. How to initialize your git hub data?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git init<\/code><\/pre>\n\n\n\n<p><strong>3. How to set your Email and User name in git?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git config --global user.email \"example@gmail.com\"\n$ git config --global user.name \"Your Name\"<\/code><\/pre>\n\n\n\n<p><strong>4. How to ?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \"C:\/Program Files\"<\/code><\/pre>\n\n\n\n<p><strong>5. How to pull?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git pull<\/code><\/pre>\n\n\n\n<p><strong>6. How to check version?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git --version<\/code><\/pre>\n\n\n\n<p><strong>7. How to push on git hub files though git bush procedure?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git add .\n$ git commit -m \"Comment\"\n$ git push origin master<\/code><\/pre>\n\n\n\n<p><strong>8. If &#8220;git push origin master &#8221; not working.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git push origin main<\/code><\/pre>\n\n\n\n<p><strong>9. How to add SHH key to git bash<\/strong><\/p>\n\n\n\n<p>= Go to your c: drive &#8211;&gt; Users &#8211;&gt; Go to your PC file and open git bash and run this<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ssh-keygen -t ed25519-sk -C \"<em>your_email@example.com<\/em>\"<\/code><\/pre>\n\n\n\n<p>Open SSH file then copy all, Open your GITHUB Go to &#8211;> Settings &#8211;> SSH and GPG keys &#8211;> Click on New SSH key paste in &#8220;key&#8221; .<\/p>\n\n\n\n<p><strong>10. How to link local repository using git bash?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git remote add origin (github-link)<\/code><\/pre>\n\n\n\n<p><strong>11. How to see what was the commited flie?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git show<\/code><\/pre>\n\n\n\n<p><strong>12. How to see history of commits?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git log<\/code><\/pre>\n\n\n\n<p><strong>13. How to Checking out a branch updates the files in the working directory<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git checkout<\/code><\/pre>\n\n\n\n<p><strong>14. How to delete locally?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> $ git branch -d &lt;branch><\/code><\/pre>\n\n\n\n<p><strong>15. How to make file in your local?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ mkdir src<\/code><\/pre>\n\n\n\n<p><strong>16. How to rename<\/strong> ?<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git mv name1 name2<\/code><\/pre>\n\n\n\n<p><strong>17. How to see how many branches you have<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git branch<\/code><\/pre>\n\n\n\n<p><strong>18. How to make a new branch?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git branch &lt;name1><\/code><\/pre>\n\n\n\n<p><strong>19. How to switch one branch to another branch?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git checkout &lt;branch name><\/code><\/pre>\n\n\n\n<p><strong>20. How to push your branch to github?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git push origin &lt;branch name><\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Git is&nbsp;a Developers tool which is use for source code management Git is&nbsp;a free and open source distributed version control system&nbsp;designed to manage any type of projects&#8230; <\/p>\n","protected":false},"author":2,"featured_media":13,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[5,7,6,8,10,13,9,12,11],"class_list":["post-7","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-git-and-github","tag-git","tag-git-config","tag-git-init","tag-change-directory","tag-check-version","tag-git-bash","tag-git-pull","tag-local-repository","tag-shh-key"],"_links":{"self":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts\/7","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/comments?post=7"}],"version-history":[{"count":7,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts\/7\/revisions"}],"predecessor-version":[{"id":16,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts\/7\/revisions\/16"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/media\/13"}],"wp:attachment":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/media?parent=7"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/categories?post=7"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/tags?post=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}