Escolar Documentos
Profissional Documentos
Cultura Documentos
Gabriel Cardoso
11 de setembro de 2022
Conteúdo
1 INTRODUÇÃO 1
1.1 OQUE É GIT? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 VANTAGENS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 INSTALAÇÃO DO GIT NO WINDOWS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.4 INSTALAÇÃO DO P4 MERGE NO WINDOWS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
4 CONFLITOS NO GIT 15
6 LISTA DE COMANDOS 22
6.1 GIT OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.1.1 MAIN PORCELAIN COMMANDS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.1.2 ANCILLARY COMMANDS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.1.3 INTERACTING WITH OTHERS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.1.4 RESET, RESTORE AND REVERT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.2 LOW-LEVEL COMMANDS (PLUMBING) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.2.1 MANIPULATION COMMANDS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.3 INTERROGATION COMMANDS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
6.3.1 SYNCING REPOSITORIES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.3.2 INTERNAL HELPER COMMANDS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.4 GUIDES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.5 IDENTIFIER TERMINOLOGY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.6 SYMBOLIC IDENTIFIERS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.7 ENVIRONMENT VARIABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.7.1 THE GIT REPOSITORY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.7.2 GIT COMMITS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
6.7.3 GIT DIFFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6.7.4 OTHER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
7 MATERIAL DE REFERÊNCIA 41
Lista de Figuras
1 Git Workflow - Documentos monitorados e não monitorados pelo Git . . . . . . . . . . . . . . . . . . . . . . . 2
2 Git Workflow - Movimentação para Working Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Git Workflow - Movimentação Add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4 Git Workflow - Movimentação commit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5 Git Workflow - Movimentação Push . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
6 Git Workflow - Movimentação Pull . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
7 Exemplo de branching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
8 Exemplo de rebasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
9 Exemplo de versionamento semântico . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
10 Tela do Git Bash para difftool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
11 Tela do P4Merge evidenciando diferenças . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Lista de Tabelas
1 A tabela de editores populares e comandos git config correspondentes . . . . . . . . . . . . . . . . . . . . . . 9
2 Tabela com elementos de um README . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3 Sintaxe de formatação do README . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Gabriel Cardoso Gaga’s Codex - Git 1
1 INTRODUÇÃO
1.1 OQUE É GIT?
Git is a free and open source distributed version control system designed to handle everything from small to very large
projects with speed and efficiency.
Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion,
CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.
1.2 VANTAGENS
Branching and Merging
Distributed
Data Assurance
1. Acesse o site para baixar a versão mais indicada para o sistema operacional: https://www.perforce.com/downloads/visual-
merge-tool
2. Execute o instalador e finalize as opções
Não os
Working Directory Staging Area Repository Repository
d
itora
Mon o Git
pel .jar .txt .txt .txt
.rar
dos
Não os.rar dos dos itora
.rar
d itora itora M o n
Git
itora Mon Git Mon Git pelo
Mon o Git pelo pelo
.rar pel
.jar .txt
.txt .txt
Mover de Diretório
O movimento é possível de ser realizado
movendo o arquivo de uma pasta não
configurada para o Git no sistema
operacional para uma pasta configurada.
Este movimento não faz com que o arquivo
se torne monitorado, somente estará no
mesmo diretório de trabalho.
.txt .txt
Mover de Área
O movimento é possível através do comando
git add. O Comando faz com que o arquivo
entre na Staging Area tornando-se
monitorável e sucesstível a commits.
Qualquer alteração no conteúdo ou nome
deste arquivo será rastreável.
.txt .txt
Mover de Área
O movimento é possível através do comando
git comit. O Comando faz com que o
arquivo entre no repositório local e
considerado como mais recente localmente.
Qualquer alteração no conteúdo ou nome
deste arquivo fará com que ele volte para a
Stagin Area e para ser oficializado deverá
passar por mais um comit..
.txt .txt
.txt .txt
Baixar da Nuvem
O movimento é possível através do comando
git pull. O Comando faz com que o arquivo
seja baixando do repositório remoto em sua
versão mais recente.
2. status resumido
sensitive1 g i t c o n f i g == g l o b a l a l i a s . s t ’ s t a t u s =sb ’
3.2 CONFIG
O comando git config é a função conveniente usada para definir valores de configuração do Git em projetos de nı́vel
global ou local. Esses nı́veis de configuração correspondem aos arquivos de texto do .gitconfig. Executar o git config modifica
arquivos de texto de configuração.
O caso de uso mais básico do git config é chamar o comando com o nome de configuração, o que vai exibir o valor
definido desse nome. Nomes de configuração são cadeias de caracteres delimitadas por pontos compostas de ”seções”e
”chaves”baseadas na hierarquia. Por exemplo: user.email.
sensitive1 g i t c o n f i g user . email
Nesse exemplo, o e-mail é propriedade filho do bloco de configuração do usuário. Isso retorna o endereço de e-mail
configurado que o Git associa com commits criados no local.
Portanto, a ordem de prioridade para os nı́veis de configuração é: local, global, sistema. Quando o Git procurar valores
de configuração, ele vai começar no nı́vel local e ir até o nı́vel de sistema.
Nesse exemplo, o valor your email@example.com é gravado no nome de configuração user.email. Ele usa o sinalizador
–global, então esse valor é definido para o usuário atual do sistema operacional. git config editor – core.editor
Muitos comandos Git iniciam o editor de texto para solicitar mais entradas. Um dos casos de uso mais comuns do
git config é configurar qual editor o Git deve usar. A tabela de editores populares e comandos git config correspondentes é
apresentada abaixo:
Sublime Text (Windows, instalação de 32 bits) git config –global core.editor ”’c:/program files (x86)/sublime text 3/sublimetext.exe’ -w”
Sublime Text (Windows, instalação de 64 bits) git config –global core.editor ”’c:/program files/sublime text 3/sublimetext.exe’ -w”
3.3 IGNORING
O Git vê cada arquivo em sua cópia de trabalho em um de três estados:
Os arquivos ignorados são rastreados em um arquivo especial chamado .gitignore, que é verificado na origem do seu
repositório. Não há nenhum comando git ignore explı́cito: é preciso editar e fazer commit do arquivo .gitignore à mão
quando você tiver novos arquivos que quer ignorar. Os arquivos .gitignore contêm padrões que são comparados com nomes
de arquivos em seu repositório para determinar se devem ou não ser ignorados. Para comentar uma linha no arquivo .gitignore
adicione o sı́mbolo # ao inı́cio da linha.
Exemplos (dentro do arquivo .gitignore):
Production Production
V1.1.1 V1.2.0
Production
Production
V1.0.0 V1.1.0
É possı́vel renomear, deletar e criar branches. Branches são labels. O merge do tipo FastForward só é possı́vel quando
não houve alteração da branch principal enquanto houve alteração da branch a ser mesclada (merged). No fast-forward
a branch desaparece ao sofrer o mergge. É possı́vel desabilitar o fast-forward mergge. Pode ser vantajoso desabilitar o
fast-forward merge para manter o histórico de alterações realizadas em branches.
Quando há alterações em arquivos de branches diferentes mas em linhas de códigos iguais ocorre um conflito de merge.
O git não permite dar o merge até que os conflitos sejam resolvidos de forma que não haja diferença.
É recomendado utilizar o ”P4MERGE”. ele ajuda a visualizare resolver os conflitos. Ao resolver problemas de
conflitos o git salva uma cópia do conflito para caso seja necessário visualizar no futuro. É possı́vel configurar o arquivo
”.gitignore”para que não sejam salvos esses arquivos ”.orig”.
3.5 REBASING
O Rebase transforma a linha principal de desenvolvimento para uma branch. Ao final o fluxo passa a ser rastreado
através da branch que recebeu o release.
Production Production
V1.1.1 V1.2.0
Production
Production
Production
V1.0.0 V1.1.0 V1.2.1
É possı́vel abortar um rebase em caso de conflitos. É possı́vel fazer um rebase em um pull. As alterações já chegam
como rebase.
3.6 STASHING
O stash serve para reservar alterações realizadas que ainda não podem ser commitadas em um ”local”seguro. As
alterações ficarão no stash até que sejam resgatadas. Eqnuanto as alterações estiverem reservadas, outras alterações poderão
ser realizadas e commitadas independentemente.
3.7 CHEERY-PICK
Given one or more existing commits, apply the change each one introduces, recording a new commit for each. This
requires your working tree to be clean (no modifications from the HEAD commit). When it is not obvious how to apply a
change, the following happens:
1. The current branch and HEAD pointer stay at the last commit successfully made.
2. The CHERRY PICK HEAD ref is set to point at the commit that introduced the change that is difficult to apply.
3. Paths in which the change applied cleanly are updated both in the index file and in your working tree.
4. For conflicting paths, the index file records up to three versions, as described in the ”TRUE MERGE”section of
git-merge[1]. The working tree files will include a description of the conflict bracketed by the usual conflict markers
<<<<<<< and >>>>>>>.
5. No other modifications are made.
3.7.1 EXEMPLOS
sensitive1 g i t c h e r r y = p i c k master
Apply the change introduced by the commit at the tip of the master branch and create a new commit with this change.
sensitive1 g i t c h e r r y = p i c k . . master
sensitive2 g i t c h e r r y = p i c k ˆHEAD master
Apply the changes introduced by all commits that are ancestors of master but not of HEAD to produce new commits.
sensitive1 g i t c h e r r y = p i c k maint next ˆ master
sensitive2 g i t c h e r r y = p i c k maint master . . next
Apply the changes introduced by all commits that are ancestors of maint or next, but not master or any of its ancestors.
Note that the latter does not mean maint and everything between master and next; specifically, maint will not be used if it
is included in master.
3.8 TAGGING
São labels que podem ser aplicados a qualquer commit. Servem para marcar entregas, versão ou destacar alguma
informação importante do desenvolvimento do código.
Há diferentes tipos de tags:
Lightweight Tag
Anotated Tag
É possı́vel adicionar um tag na versão de commit atual ou em uma commit anterior.
É possı́vel comparar commits tageados chamando por suas tags, por ex: Duas versões de software e diferentes.
É possı́vel realizar push baseado no nome da Tag. Pode ser utilizado para upar novas versões.
Uma anotaded tag é uma tag que possui uma descrição inserida ao cadastrá-la. Dessa forma é possı́vel saber o que
ela significa, por exemplo.
É importante que em desenvolvimentos de software se respeite a aplicação de lógica de versionamento às versões do
software. É recomendado a utilização do versionamento semântico 2.0.0. Este versionamento implica em uma formação de
código composto por três partes:
versão Maior(MAJOR): quando fizer mudanças incompatı́veis na API, versão
Menor(MINOR): quando adicionar funcionalidades mantendo compatibilidade
versão de Correção(PATCH): quando corrigir falhas mantendo compatibilidade.
Rótulos adicionais para pré-lançamento(pre-release) e metadados de construção(build) estão disponı́veis como extensão
ao formato MAJOR.MINOR.PATCH.
Para mais informações sobre versionamento consultar a documentação disponı́vel em: https://semver.org/lang/pt-
BR/.
Uma maneira ideal de se marcar as versões de software é por meio de TAGs com descrições padrão de versionamento.
A figura 9 mostra o padrão de versionamento de software indicado e amplamente utilizado atualmente.
4 CONFLITOS NO GIT
Há basicamente duas maneiras de se resolver problemas de conflitos em código, um deles é verificar o próprio arquivo
e localizar onde o git marca o conflito. Ao excluir uma parte do texto onde há o conflito deixando somente o desejado, o Git
irá reconhecer o que foi priorizado.
Outra maneira é por meio de uma ferramenta de destaque de diferenças, o P4Merge é a ferramenta indicada para isso.
Para utilizar a ferramenta P4Merge basta subustituir o comando ”diff”por ”difftool”.
sensitive1 g i t c o n f i g == g l o b a l == l i s t
6. Após o comando será possı́vel que o Git detectou que há um novo arquivo que não está rastreado. Para rastrear o
arquivo com o Git digite:
7. O arquivo agora está adicionado ao Working Directory do git e será rastreado em relação às alterações realizadas;
8. Apesar de já colocar o arquivo como rastreado, ele somente se encontra registrado localmente na máquina, para ”su-
bir”o arquivo para o Github ainda são necessário alguns passos. É necessário realizar o Commit, para isso digite o
comando:
9. Foi realizado o commit, ou seja, a oficialização local daquela versão do arquivo. Porém é necessário que o arquivo
seja enviado para a nuvem e o commit não faz isso. Deve-se utilizar o comando Push para ”empurrar”o arquivo para
a nuvem. Como boa prática, sempre é interessante realizar um ”Pull”antes do ”Push. O comando ”Pull”serve para
baixar todos os arquivos que venha a ser alterados por outros usuários ou diretamente pela interface Web. Execute os
seguintes comandos:
10. A mensagem de retorno do Git mostrará qual o resultado da operação. Neste caso especı́fico mostrará que o arquivo
foi empurrado para o Github com sucesso.
11. Acesse o Github pelo navegador e atualize a página. Verá que o novo arquivo foi adicionado no repositório remoto.
Ao criar um novo repositório no Git também é criada uma branch padrão chamada de main. É interessante que para o
desenvolvemento sejam utilizadas outras Branches por motivos de rastreabilidade e segurança. Para criar uma nova branch
siga os passos a seguir:
1. Para criar uma nova branch utilize o comando:
sensitive1 g i t branch d e v e l o p
4. Exitem branches que podem ser locais ou remotas. Para visualizar quais branchs existem no repositorio digite o
comando:
sensitive1 g i t branch =a
5. Com o resultado do comando anterior é possı́vel nota um pequeno asterisco (*). Ele indica a branch atual, ou seja,
alterações realizadas serão commitadas na branch atual. Para mudar de branch execute o comando:
sensitive1 g i t checkout develop
6. A partir desse momento qualquer alteração realizada será atrelada à branch ativa.
7. Não é interessante deixar branches soltas no repositório. Para isso existe o comando merge. Ele junta o final de uma
branch a outra. Para realizar o merge deverá commitar todas as pendências. Com o diretorio livre, dê um checkout
para a branch que rececberá o merge.
sensitive1 g i t c h e c k o u t main
Os comando utilizados nessa parte farão com que a branch seja inserida na branch original, sem ficar um ”galho”por fora.
2. Caso uma mensagem apareça sobre um conflito e esteja utilizando o Git BASH pressione ”ESC”e em seguida ”:q!”.
Pressione ”Enter”.
3. Para verificar as operações insira o código:
sensitive1 g i t l o g == o n e l i n e ==graph == d e c o r a t e
sensitive1 g i t c h e c k o u t =b r e b a s e b r a n c h
sensitive1 g i t c h e c k o u t main
8. Aplique o rebase:
sensitive1 g i t r e b a s e main
3. Realize quantos stash preferir e ao concluir utilize o seguinte código para visualizar os stashes salvos:
sensitive1 git stash l i s t
6 LISTA DE COMANDOS
6.1 GIT OPTIONS
1. Prints the Git suite version that the git program came from. This option is internally converted to git version ... and
accepts the same options as the git-version[1] command. If –help is also given, it takes precedence over –version.
sensitive1 =v
sensitive2 == v e r s i o n
2. Prints the synopsis and a list of the most commonly used commands. If the option –all or -a is given then all available
commands are printed. If a Git command is named this option will bring up the manual page for that command.
Other options are available to control how the manual page is displayed. See git-help[1] for more information, because
git –help ... is converted internally into git help...
sensitive1 =h
sensitive2 == h e l p
3. Run as if git was started in ¡path> instead of the current working directory. When multiple -C options are given, each
subsequent non-absolute -C ¡path> is interpreted relative to the preceding -C ¡path>. If ¡path> is present but empty,
e.g. -C , then the current working directory is left unchanged. This option affects options that expect path name like
–git-dir and –work-tree in that their interpretations of the path names would be made relative to the working directory
caused by the -C option. For example the following invocations are equivalent:
4. Pass a configuration parameter to the command. The value given will override values from configuration files. The
¡name> is expected in the same format as listed by git config (subkeys separated by dots).
Note that omitting the = in git -c foo.bar ... is allowed and sets foo.bar to the boolean true value (just like [foo]bar
would in a config file). Including the equals but with an empty value (like git -c foo.bar= ...) sets foo.bar to the empty
string which git config –type=bool will convert to false.
sensitive1 =c <name$>$=<va lue $ >$
5. Like -c ¡name>=¡value>, give configuration variable ¡name> a value, where ¡envvar> is the name of an environment
variable from which to retrieve the value. Unlike -c there is no shortcut for directly setting the value to an empty string,
instead the environment variable itself must be set to the empty string. It is an error if the ¡envvar> does not exist
in the environment. ¡envvar> may not contain an equals sign to avoid ambiguity with ¡name> containing one. This is
useful for cases where you want to pass transitory configuration options to git, but are doing so on OS’s where other
processes might be able to read your cmdline (e.g. /proc/self/cmdline), but not your environ (e.g. /proc/self/environ).
That behavior is the default on Linux, but may not be on your system. Note that this might add security for variables
such as http.extraHeader where the sensitive information is part of the value, but not e.g. url.¡base>.insteadOf where
the sensitive information can be part of the key.
sensitive1 == c o n f i g =env=<name>=<envvar>
6. Path to wherever your core Git programs are installed. This can also be controlled by setting the GIT EXEC PATH
environment variable. If no path is given, git will print the current setting and then exit.
sensitive1 ==exec =path[=<path >]
7. Print the path, without trailing slash, where Git’s HTML documentation is installed and exit.
sensitive1 ==html=path
8. Print the manpath (see man(1)) for the man pages for this version of Git and exit.
sensitive1 ==man=path
9. Print the path where the Info files documenting this version of Git are installed and exit.
sensitive1 == i n f o =path
10. Pipe all output into less (or if set, $PAGER) if standard output is a terminal. This overrides the pager.¡cmd>
configuration options.
sensitive1 =p
sensitive2 == p a g i n a t e
12. Set the path to the repository (”.git”directory). This can also be controlled by setting the GIT DIR environment
variable. It can be an absolute path or relative path to current working directory. Specifying the location of the
”.git”directory using this option (or GIT DIR environment variable) turns off the repository discovery that tries to find
a directory with ”.git”subdirectory (which is how the repository and the top-level of the working tree are discovered),
and tells Git that you are at the top level of the working tree. If you are not at the top-level directory of the working
tree, you should tell Git where the top-level of the working tree is, with the
sensitive1 == g i t = d i r=<path>
13. If you just want to run git as if it was started in ¡path> then use git -C ¡path>.
sensitive1 ==work= t r e e=<path> o p t i o n ( o r GIT\ WORK\ TREE environment
variable )
14. Set the path to the working tree. It can be an absolute path or a path relative to the current working directory. This
can also be controlled by setting the GIT WORK TREE environment variable and the core.worktree configuration
variable (see core.worktree in git-config[1] for a more detailed discussion).
15. Set the Git namespace. See gitnamespaces[7] for more details. Equivalent to setting the GIT NAMESPACE environ-
ment variable.
sensitive1 ==namespace=<path>
16. Currently for internal use only. Set a prefix which gives a path from above a repository down to its root. One use is
to give submodules context about the superproject that invoked it.
sensitive1 ==super = p r e f i x=<path>
17. Treat the repository as a bare repository. If GIT DIR environment is not set, it is set to the current working directory.
sensitive1 == b a r e
18. Do not use replacement refs to replace Git objects. See git-replace[1] for more information.
sensitive1 ==no= r e p l a c e = o b j e c t s
19. Treat pathspecs literally (i.e. no globbing, no pathspec magic). This is equivalent to setting the GIT LITERAL PATHSPECS
environment variable to 1.
sensitive1 == l i t e r a l =p a t h s p e c s
20. Add ”glob”magic to all pathspec. This is equivalent to setting the GIT GLOB PATHSPECS environment variable to
1. Disabling globbing on individual pathspecs can be done using pathspec magic ”:(literal)”
sensitive1 ==glob =p a t h s p e c s
21. Add ”literal”magic to all pathspec. This is equivalent to setting the GIT NOGLOB PATHSPECS environment variable
to 1. Enabling globbing on individual pathspecs can be done using pathspec magic ”:(glob)”
sensitive1 ==noglob =p a t h s p e c s
22. Add ”icase”magic to all pathspec. This is equivalent to setting the GIT ICASE PATHSPECS environment variable to
1.
sensitive1 == i c a s e =p a t h s p e c s
23. Do not perform optional operations that require locks. This is equivalent to setting the GIT OPTIONAL LOCKS to
0.
sensitive1 ==no= o p t i o n a l = l o c k s
24. List commands by group. This is an internal/experimental option and may change or be removed in the future. Suppor-
ted groups are: builtins, parseopt (builtin commands that use parse-options), main (all commands in libexec directory),
others (all other commands in $PATH that have git- prefix), list-¡category> (see categories in command-list.txt), nohel-
pers (exclude helper commands), alias and config (retrieve command list from config variable completion.commands)
sensitive1 == l i s t =cmds=group [ , group . . . ]
1. git-add[1]
Add file contents to the index
2. git-am[1]
Apply a series of patches from a mailbox
3. git-archive[1]
Create an archive of files from a named tree
4. git-bisect[1]
Use binary search to find the commit that introduced a bug
5. git-branch[1]
List, create, or delete branches
6. git-bundle[1]
Move objects and refs by archive
7. git-checkout[1]
Switch branches or restore working tree files
8. git-cherry-pick[1]
Apply the changes introduced by some existing commits
9. git-citool[1]
Graphical alternative to git-commit
10. git-clean[1]
Remove untracked files from the working tree
11. git-clone[1]
Clone a repository into a new directory
12. git-commit[1]
Record changes to the repository
13. git-describe[1]
Give an object a human readable name based on an available ref
14. git-diff[1]
Show changes between commits, commit and working tree, etc
15. git-fetch[1]
Download objects and refs from another repository
16. git-format-patch[1]
Prepare patches for e-mail submission
17. git-gc[1]
Cleanup unnecessary files and optimize the local repository
18. git-grep[1]
Print lines matching a pattern
19. git-gui[1]
A portable graphical interface to Git
20. git-init[1]
Create an empty Git repository or reinitialize an existing one
21. git-log[1]
Show commit logs
22. git-maintenance[1]
Run tasks to optimize Git repository data
23. git-merge[1]
Join two or more development histories together
24. git-mv[1]
Move or rename a file, a directory, or a symlink
25. git-notes[1]
Add or inspect object notes
26. git-pull[1]
Fetch from and integrate with another repository or a local branch
27. git-push[1]
Update remote refs along with associated objects
28. git-range-diff[1]
Compare two commit ranges (e.g. two versions of a branch)
29. git-rebase[1]
Reapply commits on top of another base tip
30. git-reset[1]
Reset current HEAD to the specified state
31. git-restore[1]
Restore working tree files
32. git-revert[1]
Revert some existing commits
33. git-rm[1]
Remove files from the working tree and from the index
34. git-shortlog[1]
Summarize git log output
35. git-show[1]
Show various types of objects
36. git-sparse-checkout[1]
Reduce your working tree to a subset of tracked files
37. git-stash[1]
Stash the changes in a dirty working directory away
38. git-status[1]
Show the working tree status
39. git-submodule[1]
Initialize, update or inspect submodules
40. git-switch[1]
Switch branches
41. git-tag[1]
Create, list, delete or verify a tag object signed with GPG
42. gitk[1]
The Git repository browser
9. git-merge-tree[1]
Show three-way merge without touching index
10. git-rerere[1]
Reuse recorded resolution of conflicted merges
11. git-show-branch[1]
Show branches and their commits
12. git-verify-commit[1]
Check the GPG signature of commits
13. git-verify-tag[1]
Check the GPG signature of tags
14. git-whatchanged[1]
Show logs with difference each commit introduces
15. gitweb[1]
Git web interface (web frontend to Git repositories)
1. git-archimport[1]
Import a GNU Arch repository into Git
2. git-cvsexportcommit[1]
Export a single commit to a CVS checkout
3. git-cvsimport[1]
Salvage your data out of another SCM people love to hate
4. git-cvsserver[1]
A CVS server emulator for Git
5. git-imap-send[1]
Send a collection of patches from stdin to an IMAP folder
6. git-p4[1]
Import from and submit to Perforce repositories
7. git-quiltimport[1]
Applies a quilt patchset onto the current branch
8. git-request-pull[1]
Generates a summary of pending changes
9. git-send-email[1]
Send a collection of patches as emails
10. git-svn[1]
Bidirectional operation between a Subversion repository and Git
2. git-restore[1] is about restoring files in the working tree from either the index or another commit. This command does
not update your branch. The command can also be used to restore files in the index from another commit.
3. git-reset[1] is about updating your branch, moving the tip in order to add or remove commits from the branch. This
operation changes the commit history.
git reset can also be used to restore the index, overlapping with git restore.
13. git-prune-packed[1]
Remove extra objects that are already in pack files
14. git-read-tree[1]
Reads tree information into the index
15. git-symbolic-ref[1]
Read, modify and delete symbolic refs
16. git-unpack-objects[1]
Unpack objects from a packed archive
17. git-update-index[1]
Register file contents in the working tree to the index
18. git-update-ref[1]
Update the object name stored in a ref safely
19. git-write-tree[1]
Create a tree object from the current index
14. git-pack-redundant[1]
Find redundant pack files
15. git-rev-list[1]
Lists commit objects in reverse chronological order
16. git-rev-parse[1]
Pick out and massage parameters
17. git-show-index[1]
Show packed archive index
18. git-show-ref[1]
List references in a local repository
19. git-unpack-file[1]
Creates a temporary file with a blob’s contents
20. git-var[1]
Show a Git logical variable
21. git-verify-pack[1]
Validate packed Git archive files
In general, the interrogate commands do not touch the files in the working tree.
The following are helper commands used by the above; end users typically do not use them directly.
1. git-http-fetch[1]
Download from a remote Git repository via HTTP
2. git-http-push[1]
Push objects over HTTP/DAV to another repository
3. git-receive-pack[1]
Receive what is pushed into the repository
4. git-shell[1]
Restricted login shell for Git-only SSH access
5. git-upload-archive[1]
Send archive back to git-archive
6. git-upload-pack[1]
Send objects packed back to git-fetch-pack
6.4 GUIDES
The following documentation pages are guides about Git concepts.
1. gitattributes[5]
Defining attributes per path
2. gitcli[7]
Git command-line interface and conventions
3. gitcore-tutorial[7]
A Git core tutorial for developers
4. gitcredentials[7]
Providing usernames and passwords to Git
5. gitcvs-migration[7]
Git for CVS users
6. gitdiffcore[7]
Tweaking diff output
7. giteveryday[7]
A useful minimum set of commands for Everyday Git
8. gitfaq[7]
Frequently asked questions about using Git
9. gitglossary[7]
A Git Glossary
10. githooks[5]
Hooks used by Git
11. gitignore[5]
Specifies intentionally untracked files to ignore
12. gitmailmap[5]
Map author/committer names and/or E-Mail addresses
13. gitmodules[5]
Defining submodule properties
14. gitnamespaces[7]
Git namespaces
15. gitremote-helpers[7]
Helper programs to interact with remote repositories
16. gitrepository-layout[5]
Git Repository Layout
17. gitrevisions[7]
Specifying revisions and ranges for Git
18. gitsubmodules[7]
Mounting one repository inside another
19. gittutorial[7]
A tutorial introduction to Git
20. gittutorial-2[7]
A tutorial introduction to Git: part two
21. gitworkflows[7]
An overview of recommended workflows with Git
2. <blob>
Indicates a blob object name.
3. <tree>
Indicates a tree object name.
4. <commit>
Indicates a commit object name.
5. <tree-ish>
Indicates a tree, commit or tag object name. A command that takes a <tree-ish> argument ultimately wants to
operate on a <tree> object but automatically dereferences <commit> and <tag> objects that point at a <tree>.
6. <commit-ish>
Indicates a commit or tag object name. A command that takes a <commit-ish> argument ultimately wants to operate
on a <commit> object but automatically dereferences <tag> objects that point at a <commit>.
7. <type>
Indicates that an object type is required. Currently one of: blob, tree, commit, or tag.
8. <file>
Indicates a filename - almost always relative to the root of the tree structure GIT INDEX FILE describes.
where: <old—new>-file
are files GIT EXTERNAL DIFF can use to read the contents of <old—new>, <old—new>-hex
are the 40-hexdigit SHA-1 hashes, <old—new>-mode
are the octal representation of the file modes.
The file parameters can point at the user’s working file (e.g. new-file in ”git-diff-files”), /dev/null (e.g. old-file when
a new file is added), or a temporary file (e.g. old-file in the index). GIT EXTERNAL DIFF should not worry about
unlinking the temporary file — it is removed when GIT EXTERNAL DIFF exits.
For a path that is unmerged, GIT EXTERNAL DIFF is called with 1 parameter, <path>.
For each path GIT EXTERNAL DIFF is called, two environment variables, GIT DIFF PATH COUNTER and GIT DIFF PAT
are set.
3. GIT DIFF PATH COUNTER
A 1-based counter incremented by one for every path.
4. GIT DIFF PATH TOTAL
The total number of paths.
6.7.4 OTHER
1. GIT MERGE VERBOSITY
A number controlling the amount of output shown by the recursive merge strategy. Overrides merge.verbosity. See
git-merge[1]
2. GIT PAGER
This environment variable overrides $PAGER. If it is set to an empty string or to the value ”cat”, Git will not launch
a pager. See also the core.pager option in git-config[1].
3. GIT PROGRESS DELAY
A number controlling how many seconds to delay before showing optional progress indicators. Defaults to 2.
4. GIT EDITOR
This environment variable overrides $EDITOR and $VISUAL. It is used by several Git commands when, on interactive
mode, an editor is to be launched. See also git-var[1] and the core.editor option in git-config[1].
5. GIT SEQUENCE EDITOR
This environment variable overrides the configured Git editor when editing the todo list of an interactive rebase. See
also git-rebase[1] and the sequence.editor option in git-config[1].
6. GIT SSH
GIT SSH COMMAND
If either of these environment variables is set then git fetch and git push will use the specified command instead of ssh
when they need to connect to a remote system. The command-line parameters passed to the configured command are
determined by the ssh variant. See ssh.variant option in git-config[1] for details.
$GIT SSH COMMAND takes precedence over $GIT SSH, and is interpreted by the shell, which allows additional
arguments to be included. $GIT SSH on the other hand must be just the path to a program (which can be a wrapper
shell script, if additional arguments are needed).
Usually it is easier to configure any desired options through your personal .ssh/config file. Please consult your ssh
documentation for further details.
7. GIT SSH VARIANT
If this environment variable is set, it overrides Git’s autodetection whether GIT SSH/GIT SSH COMMAND/core.sshCommand
refer to OpenSSH, plink or tortoiseplink. This variable overrides the config setting ssh.variant that serves the same
purpose.
8. GIT ASKPASS
If this environment variable is set, then Git commands which need to acquire passwords or passphrases (e.g. for
HTTP or IMAP authentication) will call this program with a suitable prompt as command-line argument and read
the password from its STDOUT. See also the core.askPass option in git-config[1].
Take the configuration from the given files instead from global or system-level configuration files. If GIT CONFIG SYSTEM
is set, the system config file defined at build time (usually /etc/gitconfig) will not be read. Likewise, if GIT CONFIG GLOBAL
is set, neither $HOME/.gitconfig nor $XDG CONFIG HOME/git/config will be read. Can be set to /dev/null to skip
reading configuration files of the respective level.
11. GIT CONFIG NOSYSTEM
Whether to skip reading settings from the system-wide $(prefix)/etc/gitconfig file. This environment variable can be
used along with $HOME and $XDG CONFIG HOME to create a predictable environment for a picky script, or you
can set it temporarily to avoid using a buggy /etc/gitconfig file while waiting for someone with sufficient permissions
to fix it.
12. GIT FLUSH
If this environment variable is set to ”1”, then commands such as git blame (in incremental mode), git rev-list, git log,
git check-attr and git check-ignore will force a flush of the output stream after each record have been flushed. If this
variable is set to ”0”, the output of these commands will be done using completely buffered I/O. If this environment
variable is not set, Git will choose buffered or record-oriented flushing based on whether stdout appears to be redirected
to a file or not.
7 MATERIAL DE REFERÊNCIA
Documentação de referência:
https://git-scm.com/docs
Documentação sobre versionamento e readme
https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2021EA001797