{"id":344,"date":"2025-01-15T08:08:32","date_gmt":"2025-01-15T08:08:32","guid":{"rendered":"https:\/\/andreilebedev24.thkit.ee\/?page_id=344"},"modified":"2025-01-15T08:08:32","modified_gmt":"2025-01-15T08:08:32","slug":"git-exercise","status":"publish","type":"page","link":"https:\/\/andreilebedev24.thkit.ee\/ru\/git-cmd-kasurida\/git-exercise\/","title":{"rendered":"Git Exercise."},"content":{"rendered":"\n<p><strong>Insert the missing part of the command to check which version of Git (if any) is installed.<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git &#8212;versoin<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/andreilebedev24.thkit.ee\/wp-content\/uploads\/2025\/01\/Nimetu1.png\" alt=\"\" class=\"wp-image-350\" \/><\/figure>\n\n\n\n<p><strong>Initialize Git on the current folder:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git init<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/andreilebedev24.thkit.ee\/wp-content\/uploads\/2025\/01\/Nimetu2.png\" alt=\"\" class=\"wp-image-351\" \/><\/figure>\n\n\n\n<p><strong>Set the user name for the current repository to &#171;w3schools-test&#187;:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git config user.name &#171;w3schools-test&#187;<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/andreilebedev24.thkit.ee\/wp-content\/uploads\/2025\/01\/Nimetu3.png\" alt=\"\" class=\"wp-image-352\" \/><\/figure>\n\n\n\n<p><strong>Check the status of the Git:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git status<\/li>\n<\/ul>\n\n\n\n<p><strong>Add&nbsp;<code>index.html<\/code>&nbsp;to the Staging Enviornment:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git add <code>index.html<\/code><\/li>\n<\/ul>\n\n\n\n<p><strong>Stage all new, modified, and deleted files. Use the shorthand command:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git add -A<\/li>\n<\/ul>\n\n\n\n<p><strong>Commit the changes to the current repository with the message &#171;First release!&#187;<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git commit -m &#171;First release!&#187;<\/li>\n<\/ul>\n\n\n\n<p><strong>Check the compact version of the status for repository:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git status &#8212;short<\/li>\n<\/ul>\n\n\n\n<p><strong>Commit the updated files directly, skipping the staging environment:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git commit -a -m &#171;New line added&#187;<\/li>\n<\/ul>\n\n\n\n<p><strong>View the history of commits for the repository:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git log<\/li>\n<\/ul>\n\n\n\n<p><strong>Show the possible options for the&nbsp;<code>status<\/code>&nbsp;command in command line:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git status -help<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/andreilebedev24.thkit.ee\/wp-content\/uploads\/2025\/01\/Nimetu4.png\" alt=\"\" class=\"wp-image-353\" \/><\/figure>\n\n\n\n<p><strong>Show all git possible commands in command line:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git help &#8212;all<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/andreilebedev24.thkit.ee\/wp-content\/uploads\/2025\/01\/Nimetu5.png\" alt=\"\" class=\"wp-image-354\" \/><\/figure>\n\n\n\n<p><strong>Create a new branch called&nbsp;<code>hello-world-images<\/code>:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git branch hello-world-images<\/li>\n<\/ul>\n\n\n\n<p><strong>List the existing branches:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git branch<\/li>\n<\/ul>\n\n\n\n<p><strong>Move to the&nbsp;<code>hello-world-images<\/code>&nbsp;<code>branch<\/code>:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git checkout <code>hello-world-images<\/code><\/li>\n<\/ul>\n\n\n\n<p><strong>Create, and move to a new&nbsp;<code>branch<\/code>&nbsp;with the name&nbsp;<code>hello-you<\/code>:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git checkout -b<\/li>\n<\/ul>\n\n\n\n<p><strong>Merge the&nbsp;<code>hello-you<\/code>&nbsp;branch with the current branch:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git merge hello-you<\/li>\n<\/ul>\n\n\n\n<p><strong>Remove the&nbsp;<code>hello-you<\/code>&nbsp;branch from the local repository:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git branch -d hello-you<\/li>\n<\/ul>\n\n\n\n<p><strong>Add a&nbsp;<code>remote<\/code>&nbsp;repository as an&nbsp;<code>origin<\/code>:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git remote add origin https:\/\/github.com\/x\/y.git<\/li>\n<\/ul>\n\n\n\n<p><code>pull<\/code>&nbsp;is a combination of:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>fetch and then merge<\/li>\n<\/ul>\n\n\n\n<p>Get all the change history of the origin for this branch:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git fetch origin<\/li>\n<\/ul>\n\n\n\n<p>Merge the current branch with the branch master, on origin:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git merge origin\/master<\/li>\n<\/ul>\n\n\n\n<p>Update the current branch from its origin using a single command:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git pull origin<\/li>\n<\/ul>\n\n\n\n<p><code>push<\/code>&nbsp;the current&nbsp;<code>branch<\/code>&nbsp;to its default remote&nbsp;<code>origin<\/code>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git push origin<\/li>\n<\/ul>\n\n\n\n<p>List all local and remote branches of the current Git.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git branch -a <\/li>\n<\/ul>\n\n\n\n<p>List only remote branches of the current Git.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git branch -r<\/li>\n<\/ul>\n\n\n\n<p>Clone the repository:&nbsp;<code>https:\/\/abc.com\/x\/y.git<\/code>&nbsp;to your local Git:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git clone https:\/\/abc.com\/x\/y.git<\/li>\n<\/ul>\n\n\n\n<p>Clone the repository&nbsp;<code>https:\/\/abc.com\/x\/y.git<\/code>&nbsp;to a folder named &#171;<code>newlife<\/code>&#171;:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git clone https:\/\/abc.com\/x\/y.git newlife<\/li>\n<\/ul>\n\n\n\n<p>Rename the&nbsp;<code>origin<\/code>&nbsp;<code>remote<\/code>&nbsp;to&nbsp;<code>upstream<\/code>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git remote rename origin <code>upstream<\/code><\/li>\n<\/ul>\n\n\n\n<p>In\u00a0<code>.gitignore<\/code>\u00a0add a line to ignore all\u00a0<code>.temp<\/code>\u00a0files:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>*.temp<\/li>\n<\/ul>\n\n\n\n<p>In\u00a0<code>.gitignore<\/code>\u00a0add a line to ignore all files in any directory named\u00a0<code>temp<\/code>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>temp\/<\/li>\n<\/ul>\n\n\n\n<p>In\u00a0<code>.gitignore<\/code>\u00a0add a single line to ignore all files named\u00a0<code>temp1.log<\/code>,\u00a0<code>temp2.log<\/code>, and\u00a0<code>temp3.log<\/code>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>temp?.log<\/li>\n<\/ul>\n\n\n\n<p>In\u00a0<code>.gitignore<\/code>, ignore all\u00a0<code>.log<\/code>\u00a0files, except\u00a0<code>main.log<\/code>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>*.log<\/li>\n\n\n\n<li>!main.log&#8217;<\/li>\n<\/ul>\n\n\n\n<p>Add a new\u00a0<code>remote<\/code>\u00a0named\u00a0<code>ssh-origin<\/code>\u00a0connecting to\u00a0<code>x\/y.git<\/code>\u00a0on\u00a0<code>abc.com<\/code>\u00a0using\u00a0<code>SSH<\/code>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git remote add ssh-origin git@abc.com:x\/y.git<\/li>\n<\/ul>\n\n\n\n<p>Replace the\u00a0<code>remote<\/code>\u00a0<code>URL<\/code>\u00a0for\u00a0<code>origin<\/code>\u00a0with\u00a0<code>x\/y.git<\/code>\u00a0on\u00a0<code>abc.com<\/code>\u00a0using\u00a0<code>SSH<\/code>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git remoat set-url origin git@abc.com:x\/y.git<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/andreilebedev24.thkit.ee\/wp-content\/uploads\/2025\/01\/Nimetu6-1024x825.png\" alt=\"\" class=\"wp-image-359\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Insert the missing part of the command to check which version of Git [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":336,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-344","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Git Exercise. - Andrei Lebedev \/Portfolio\/RU<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/andreilebedev24.thkit.ee\/ru\/git-cmd-kasurida\/git-exercise\/\" \/>\n<meta property=\"og:locale\" content=\"ru_RU\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git Exercise. - Andrei Lebedev \/Portfolio\/RU\" \/>\n<meta property=\"og:description\" content=\"Insert the missing part of the command to check which version of Git [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/andreilebedev24.thkit.ee\/ru\/git-cmd-kasurida\/git-exercise\/\" \/>\n<meta property=\"og:site_name\" content=\"Andrei Lebedev \/Portfolio\/RU\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 \u043c\u0438\u043d\u0443\u0442\u044b\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/ru\\\/git-cmd-kasurida\\\/git-exercise\\\/\",\"url\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/ru\\\/git-cmd-kasurida\\\/git-exercise\\\/\",\"name\":\"Git Exercise. - Andrei Lebedev \\\/Portfolio\\\/RU\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/ru\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/ru\\\/git-cmd-kasurida\\\/git-exercise\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/ru\\\/git-cmd-kasurida\\\/git-exercise\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/Nimetu1.png\",\"datePublished\":\"2025-01-15T08:08:32+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/ru\\\/git-cmd-kasurida\\\/git-exercise\\\/#breadcrumb\"},\"inLanguage\":\"ru-RU\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/ru\\\/git-cmd-kasurida\\\/git-exercise\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ru-RU\",\"@id\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/ru\\\/git-cmd-kasurida\\\/git-exercise\\\/#primaryimage\",\"url\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/Nimetu1.png\",\"contentUrl\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/Nimetu1.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/ru\\\/git-cmd-kasurida\\\/git-exercise\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\",\"item\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/ru\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Git CMD k\u00e4surida\",\"item\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/ru\\\/git-cmd-kasurida\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Git Exercise.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/ru\\\/#website\",\"url\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/ru\\\/\",\"name\":\"Andrei Lebedev \\\/Portfolio\\\/RU\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/andreilebedev24.thkit.ee\\\/ru\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ru-RU\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Git Exercise. - Andrei Lebedev \/Portfolio\/RU","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/andreilebedev24.thkit.ee\/ru\/git-cmd-kasurida\/git-exercise\/","og_locale":"ru_RU","og_type":"article","og_title":"Git Exercise. - Andrei Lebedev \/Portfolio\/RU","og_description":"Insert the missing part of the command to check which version of Git [&hellip;]","og_url":"https:\/\/andreilebedev24.thkit.ee\/ru\/git-cmd-kasurida\/git-exercise\/","og_site_name":"Andrei Lebedev \/Portfolio\/RU","twitter_card":"summary_large_image","twitter_misc":{"\u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f":"3 \u043c\u0438\u043d\u0443\u0442\u044b"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/andreilebedev24.thkit.ee\/ru\/git-cmd-kasurida\/git-exercise\/","url":"https:\/\/andreilebedev24.thkit.ee\/ru\/git-cmd-kasurida\/git-exercise\/","name":"Git Exercise. - Andrei Lebedev \/Portfolio\/RU","isPartOf":{"@id":"https:\/\/andreilebedev24.thkit.ee\/ru\/#website"},"primaryImageOfPage":{"@id":"https:\/\/andreilebedev24.thkit.ee\/ru\/git-cmd-kasurida\/git-exercise\/#primaryimage"},"image":{"@id":"https:\/\/andreilebedev24.thkit.ee\/ru\/git-cmd-kasurida\/git-exercise\/#primaryimage"},"thumbnailUrl":"https:\/\/andreilebedev24.thkit.ee\/wp-content\/uploads\/2025\/01\/Nimetu1.png","datePublished":"2025-01-15T08:08:32+00:00","breadcrumb":{"@id":"https:\/\/andreilebedev24.thkit.ee\/ru\/git-cmd-kasurida\/git-exercise\/#breadcrumb"},"inLanguage":"ru-RU","potentialAction":[{"@type":"ReadAction","target":["https:\/\/andreilebedev24.thkit.ee\/ru\/git-cmd-kasurida\/git-exercise\/"]}]},{"@type":"ImageObject","inLanguage":"ru-RU","@id":"https:\/\/andreilebedev24.thkit.ee\/ru\/git-cmd-kasurida\/git-exercise\/#primaryimage","url":"https:\/\/andreilebedev24.thkit.ee\/wp-content\/uploads\/2025\/01\/Nimetu1.png","contentUrl":"https:\/\/andreilebedev24.thkit.ee\/wp-content\/uploads\/2025\/01\/Nimetu1.png"},{"@type":"BreadcrumbList","@id":"https:\/\/andreilebedev24.thkit.ee\/ru\/git-cmd-kasurida\/git-exercise\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430","item":"https:\/\/andreilebedev24.thkit.ee\/ru\/"},{"@type":"ListItem","position":2,"name":"Git CMD k\u00e4surida","item":"https:\/\/andreilebedev24.thkit.ee\/ru\/git-cmd-kasurida\/"},{"@type":"ListItem","position":3,"name":"Git Exercise."}]},{"@type":"WebSite","@id":"https:\/\/andreilebedev24.thkit.ee\/ru\/#website","url":"https:\/\/andreilebedev24.thkit.ee\/ru\/","name":"Andrei Lebedev \/Portfolio\/RU","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/andreilebedev24.thkit.ee\/ru\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ru-RU"}]}},"_links":{"self":[{"href":"https:\/\/andreilebedev24.thkit.ee\/ru\/wp-json\/wp\/v2\/pages\/344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/andreilebedev24.thkit.ee\/ru\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/andreilebedev24.thkit.ee\/ru\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/andreilebedev24.thkit.ee\/ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/andreilebedev24.thkit.ee\/ru\/wp-json\/wp\/v2\/comments?post=344"}],"version-history":[{"count":0,"href":"https:\/\/andreilebedev24.thkit.ee\/ru\/wp-json\/wp\/v2\/pages\/344\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/andreilebedev24.thkit.ee\/ru\/wp-json\/wp\/v2\/pages\/336"}],"wp:attachment":[{"href":"https:\/\/andreilebedev24.thkit.ee\/ru\/wp-json\/wp\/v2\/media?parent=344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}