Commands Tutorial - Part 1
The command line is the only place you can run all Git commands. If you know how to run the command-line version you can probably also figure out how to run the GUI version. Also, while your choice of graphical client is a matter of personal taste, all users will have the command-line tools installed and available. You can read more on gits official online book .
Before we start, be sure to know how to use the Terminal in Mac or Command Prompt or Powershell in Windows and have git installed on your system.
Introduction
First, you might ask yourself what is Git actually and what can you do with it? Git is a fast, scalable, distributed **revision control system* with a rich command set that provides both high-level operations and full access to internals. *
In Kolosek, we use Git for every application we create, including Ruby on Rails projects , to make it easier to work as a team and achieve our goal.
You can learn a lot about individual Git commands by running
$git help
command in the Terminal. This should appear:Everything can be added to your git repositories even your 컨트롤러 테스트 !
Git Options
We will cover the most commonly used command lines, starting from Git options. This will explain everything you need to know about Git on your local machine:
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path]
[--info-path] [-p | --paginate | --no-pager]
[--no-replace-objects] [--bare] [--git-dir=<path>]
[--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
$git --version
: Find out your current Git suite version using this command. $git --help
:Every 좋은 programmer should know about this option, it will show you the most used Git Commands, it can also print all available commands with --all
9.4 .-a
: Instead of running Git from the current working directory, you can run it from the given $git -C <path>
instead. <path>
command affects other options that expect path names like -C <path>
and --git-dir
because their path names would be made relative to the working directory caused by the -C option.--work-tree
: You can very easily override values from your configuration files. The $git -c <name>=<value>
has to be in the same format as listed by git config, while the <name>
is your new parameter<value>
: This command helps you find the path where your core Git programs are installed. Another way to do this is by setting the $git --exec-path[=<path>]
environment variable. GIT_EXEC_PATH
: Always use this option, whenever you need to set a path to the repository or set the $git --git-dir=<path>
environment variable. We often used these Git options when we were setting up CarrierWave example to Git. Did you have a similar experience?
GIT_DIR
: In this way, you can set the path to the current working tree. You can do this as well by setting the $git --work-tree=<path>
environment variable. GIT_WORK_TREE
: Set your Git namespace with this command or by using $git --namespace=<path>
environment variable. And, that's it! For now, to be exact.
This was only the first part of the tutorial! In the next one, we will cover all the other Git commands, be sure to stay tuned.
This post is originally published on Kolosek Blog .
Reference
이 문제에 관하여(Commands Tutorial - Part 1), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/Kolosek/items/088d8f12a51b1b40f4c5텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)