From 16e1e50199ef847a90a5201f5a0e5bdb0fa42227 Mon Sep 17 00:00:00 2001 From: Shyam Date: Mon, 18 Apr 2016 02:41:22 +0530 Subject: [PATCH 1/2] Improving docs: Start using Git --- .../basicsimages/git_version_cli.png | Bin 0 -> 4215 bytes doc/gitlab-basics/start-using-git.md | 59 +++++++++++------- 2 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 doc/gitlab-basics/basicsimages/git_version_cli.png diff --git a/doc/gitlab-basics/basicsimages/git_version_cli.png b/doc/gitlab-basics/basicsimages/git_version_cli.png new file mode 100644 index 0000000000000000000000000000000000000000..712219e3eac6f982d603f7074f72fd521c0809ab GIT binary patch literal 4215 zcmeAS@N?(olHy`uVBq!ia0y~yU^HQ1VDRT)Vqjo+Rk*H>fq{X!*vT`5gM;JtL;nX1 z3=EPbt`Q}{`DrEPiAAXl>3R9Nsk+6ldAc};RLpsMw>rkB zQkvmI`ZJTuf9s}iE8lp^OXbNnjXgVcqpxW_-S&D?$JEsLH8EoPJ5|<{o>lGASQxT? z-JuXK;Y9J&?g{U%&s=tH&iDS6r8j40&hkpH*e72<*K+#(%5(26&7Z$KzG2HNHV(yK ziDhNX0#1(-i+uYvIWX}uNOgJ07b!TVb&iDSI+huYWfBn>K;*huMZx~BO zx#iZMTW;kP{nlR@#pe1n_eEouH2cdV@24|m?kW3r>$2Th)$;Ft zdeYj3r~8f;?TE>HHFdB3jSQp4g_aq`NuSOM-r~8)!}B(u+)fa3$uD^WIr2Mw^vdf%b@Wj75b$h?+)vCik zXWaO&8uKes{R_+e%CvmW@`VfxJf){sO8cuXDc-y}FZSl^%=PXJ3@i9Q`g8q1&vai{ zFwpSh_25~ze(D`6xN@sw%7yuDuLKzu%+E+L zG&e9)G*nb9dM(hq?EaQtJMwHqPoI2NwAncL(DokF9KH+okCgMRIVWqjTh2KgoU(&A z_|k>&$A7m85ZJ*}vH_SvUt#gof;!X~Tpy=_=% zn)CbXlU(On^5GJY`#+IB0uVaX2075w++O4$5f{l1R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{=)(ovd)=x^P{Hz^!X(1?NonZPi%EgZz$u5S2gFNk8XW*J5u7=W}o7_uO7_4ZL)IJo+k^I zJ&MZI_lxdVs@$r=S=yT)%W?IMS)858MTS>gI}MN9PH)*C8?K&L*YdA3G4m>KccI`S zMKuqNW4Z^DVp^<34_{g(E%sQ+#W^CUSHQRQm4n-h<`d6~j{3d7z5YIX9%q*5n&&PZ z%fP8v=BAYUHaC-2<><@%J7RjuWN%7c6zR+P`!B>*;^NL)s9e2}a$4pV(YToWE$jSv1#j%rFQEkuAS&~XyV%Y^ZzHy+?3K(k-7OR zSOUU`Dm-bm$+Ygrx&=@C{8SGIX8Y$G-Lt-G&DDN>skx6ItLk}ir~LjL+2)y@0mmn( zTdvMqQ?McX`!t1?dyVy+jEb`k@p}tEavs-YVZ~X8p1`~T%8WD?di8(b=MSk*9iCS* QFfcH9y85}Sb4q9e0Cvta4*&oF literal 0 HcmV?d00001 diff --git a/doc/gitlab-basics/start-using-git.md b/doc/gitlab-basics/start-using-git.md index 89ce8bcc3e88b2..6addc8af7a1f38 100644 --- a/doc/gitlab-basics/start-using-git.md +++ b/doc/gitlab-basics/start-using-git.md @@ -1,13 +1,17 @@ -# Start using Git on the command line +# Start using Git on the command-line -If you want to start using a Git and GitLab, make sure that you have created an -account on GitLab. +To start using GitLab using the command-line, you will need the following: +- [An account](https://gitlab.com/users/sign_in) on GitLab. +- A shell to access Git's functionality using the command-line. +- The Git command-line program; either as an individual program or as a part of the shell itself. ## Open a shell -Depending on your operating system, find the shell of your preference. Here are some suggestions. +Fire up the shell of your preference. -- [Terminal](http://blog.teamtreehouse.com/introduction-to-the-mac-os-x-command-line) on Mac OSX +Below are some of the popular options on OS X, Windows and Linux. + +- [Terminal](http://blog.teamtreehouse.com/introduction-to-the-mac-os-x-command-line) on OS X - [GitBash](https://msysgit.github.io) on Windows @@ -15,24 +19,27 @@ Depending on your operating system, find the shell of your preference. Here are ## Check if Git has already been installed -Git is usually preinstalled on Mac and Linux. +Git is often pre-installed on OS X and Linux. -Type the following command and then press enter: +To check if that is the case, type the following command into the shell and then press enter: ``` git --version ``` +If Git is installed, you should see a message that will tell you which Git version you have in your computer. + +![git --version command](basicsimages/git_version_cli.png) -You should receive a message that will tell you which Git version you have in your computer. If you don’t receive a "Git version" message, it means that you need to [download Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git). +If you don’t receive a "Git version" message, it means that you need to [install Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) on your operating system. -If Git doesn't automatically download, there's an option on the website to [download manually](https://git-scm.com/downloads). Then follow the steps on the installation window. +You can also install Git using one of the [official installers](https://git-scm.com/downloads). -After you finished installing, open a new shell and type "git --version" again to verify that it was correctly installed. +Once you have finished installing Git, open a new shell and type "git --version" once again to verify that it was correctly installed. ## Add your Git username and set your email -It is important because every Git commit that you create will use this information. +Every Git commit that you create will show your username and email. Therefore, it is important to set this properly. -On your shell, type the following command to add your username: +In your shell, type the following command to add your username: ``` git config --global user.name ADD YOUR USERNAME ``` @@ -51,8 +58,9 @@ To verify that you entered your email correctly, type: ``` git config --global user.email ``` +Using the "--global" option means that you need to set this information only once. After this, Git will always use this information everywhere. -You'll need to do this only once because you are using the "--global" option. It tells Git to always use this information for anything you do on that system. If you want to override this with a different username or email address for specific projects, you can run the command without the "--global" option when you’re in that project. +If you want to override this with a different username or email address for specific projects, you can run the command without the "--global" option when you’re in that project. ## Check your information @@ -62,6 +70,8 @@ git config --global --list ``` ## Basic Git commands +Let us go through some of the basic Git commands. + ### Go to the master branch to pull the latest changes from there ``` @@ -69,14 +79,14 @@ git checkout master ``` ### Download the latest changes in the project -This is for you to work on an up-to-date copy (it is important to do every time you work on a project), while you setup tracking branches. +This is for you to work on an up-to-date copy (it is important to do this every time you work on a project), while you setup tracking branches. ``` git pull REMOTE NAME-OF-BRANCH -u ``` -(REMOTE: origin) (NAME-OF-BRANCH: could be "master" or an existing branch) +A good example for REMOTE could be 'origin' and the NAME-OF-BRANCH could be 'master' or an existing branch. ### Create a branch -Spaces won't be recognized, so you need to use a hyphen or underscore. +Spaces are not valid in naming branches. You can to use a hyphens or underscores as separators in their place. ``` git checkout -b NAME-OF-BRANCH ``` @@ -86,16 +96,21 @@ git checkout -b NAME-OF-BRANCH git checkout NAME-OF-BRANCH ``` -### View the changes you've made -It's important to be aware of what's happening and what's the status of your changes. +### View the changes you have made +Before you start the process to commit your changes, it is important to review the changes you have made. ``` git status ``` - ### Add changes to commit -You'll see your changes in red when you type "git status". +Git will highlight all untracked changes in red when you type "git status". + +To add any of the files shown in red to the commit, you have to use the following command: +``` +git add FILENAME +``` + +Once you have added the files, commit them with a message that describes the intention of the commit. This will help others understand easily what is the purpose of the commit. ``` -git add CHANGES IN RED git commit -m "DESCRIBE THE INTENTION OF THE COMMIT" ``` @@ -115,7 +130,7 @@ git clean -f ``` ### Merge created branch with master branch -You need to be in the created branch. +You need to be in the created branch to successfully complete this operation. ``` git checkout NAME-OF-BRANCH git merge master -- GitLab From 98596c18b9a19cb9d33a6c394fa655f6170c7140 Mon Sep 17 00:00:00 2001 From: Shyam Date: Mon, 18 Apr 2016 02:50:55 +0530 Subject: [PATCH 2/2] Improving docs: Start using Git [ci-skip] --- doc/gitlab-basics/start-using-git.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/gitlab-basics/start-using-git.md b/doc/gitlab-basics/start-using-git.md index 6addc8af7a1f38..e18599fea024b4 100644 --- a/doc/gitlab-basics/start-using-git.md +++ b/doc/gitlab-basics/start-using-git.md @@ -109,7 +109,9 @@ To add any of the files shown in red to the commit, you have to use the followin git add FILENAME ``` -Once you have added the files, commit them with a message that describes the intention of the commit. This will help others understand easily what is the purpose of the commit. +Once you have added the files, commit them with a message that describes the intention of the commit. + +This will help others understand easily what is the purpose of the commit. ``` git commit -m "DESCRIBE THE INTENTION OF THE COMMIT" ``` -- GitLab