apt-get install git-coreGerando a chave
ssh-keygen -t rsa -C "diegolirio.dl@gmail.com"Instalando o xclip para realizar copia p/ area de transferencia
sudo apt-get install xclipLocal da chave /home/diego/.ssh/id_rsa.pub
Copiando chave para area de transferencia
xclip -sel clip < id_rsa.pubConfigurando usuario para commits
git connfig --global user.name "Diego Lirio"
git connfig --global user.email "diegolirio.dl@gmail.com"Iniciar um diretorio
git initAdd arquivo
git add arquivo.javaAdd todos os Estagios All
git add -A Add os estagios novo_arquivo e os modificados, without deleted
git add . stages modified and deleted, without new
git add -uVoltar add
git resetcommit, subir para repositorio local
git commit -m "Commit, comentario do commit"commit, subir todas as alterações, inclusao e exclusão...
git commit -a -m "Commit, comentario do commit"????? Analisar commando abaixo
git commit --amend -m "se após o comite você notar um erro na mensagem ou esquecido de adicionar algum outro arquivo, experimente comitar com o argumento --amend."remote - linkar com o repositorio remoto...
git remote add origin git@bitbucket.org:diegolirio/MenuTdvWeb.gitPara trabalhar com dois remote ao mesmo tempo, Add um outro remote.
git remote add github git@github.com:diegolirio/MenuTdvWeb.gitAlterar origin do remote
git remote set-url origin git://bitbucket.org/asisco/MenuTdvWeb.git------- (erro: nao consegui se conectar com servidor remoto com esse comando ---> )
git remote set-url origin git://github.com/CaioProiete/MenuTdvWeb.gitVisualizar repositorio remoto que estou apontando. (Ex: no caso o origin aponto para o git@bitbucket.org:diegolirio/exemplo.git)
git remote show originSe no caso add um outro remote apontando para um outro servidor remoto (Ex: no caso o 'github' aponto para o git@github.com:diegolirio/exemplo.git)
git remote show githubver remotes cadastrados
git remote -vremover da lista de remote
git remote rm githubpara realizar o commit para o repositorio remoto (Atualizar repositorio remoto de acordo c/ o seu repositorio local)
git push -u origin mastersubir para repositorio remoto
git push origin master
git push github masteratualizar, repositorio Local de acordo com o remoto
git pullatualizar indicando o repositorio
git pull origin master
git pull github mastercopiar um projeto remoto para repositorio local (baixar)
git clone git@github.com:diegolirio/MenuTdvWeb.gitBRANCH Trabalhando com branch (criando um branch local)
git branch workingMudar o Head para o branch criado
git checkout workingCriar branch e mudar para ele ao criar
git checkout -b workingCriar branch e mudar para ele ao criar
git checkout -b workingCriar no servidor EX: github.com Após alguma alteração e dado um commit no branch working basta fazer:
git push origin workingMerge Simples Após alterar voltar para o master e realizar o merge
git checkout master
git merge workingPara remover um branch local você faz
git branch -d workingSe quiser que essa remoção se reproduza no remoto faça:
git push origin :workingSe quiser apagar o branch remoto do github sem ter o branch localmente instalado faça:
git push origin --delete workingSe quiser renomear um branch local faça:
git branch -m working new_working==================================================
Para criar uma TAG chamada FRG83-R002 no commit atual execute:
git tag FRG83-R002Para criar uma TAG chamada FRG83-R001 no commit 4b8ef995de6d77 execute:
git tag FRG83-R001 4b8ef995de6d77Para submete-la para o servidor execute:
git push --tags origin masterPara deletar uma TAG execute:
git tag -d FRG83-R001
git push origin :refs/tags/FRG83-R001Para voce mover para o commit da TAG execute:
git checkout FRG83-R001Deletar todas as Tags no Server
git push --delete origin $(git tag --list)############################################################
mais exemplos
- Install and configure the necessary dependencies
If you install Postfix to send email please select 'Internet Site' during setup. Instead of using Postfix you can also use Sendmail or configure a custom SMTP server and configure it as an SMTP server. On CentOS, the commands below will also open HTTP and SSH access in the system firewall.
sudo apt-get install curl openssh-server ca-certificates postfix
- Add the GitLab package server and install the package
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce
If you are not comfortable installing the repository through a piped script, you can find the entire script here and select and download the package manually and install using
dpkg -i gitlab-ce-XXX.deb
- Configure and start GitLab
sudo gitlab-ctl reconfigure
- Browse to the hostname and login
On your first visit, you'll be redirected to a password reset screen to provide the password for the initial administrator account. Enter your desired password and you'll be redirected back to the login screen.
The default account's username is root. Provide the password you created earlier and login. After login you can change the username if you wish.
- Change Domain Name
Edit the /etc/gitlab/gitlab.rb file,external_urlwith your new domain name or IP, and runsudo gitlab-ctl reconfigure
See the documentation in gitlab
git rebase -i HEAD~3
Send to stash
git stash
See list
git stash list
apply
git stash apply@{0}