GIT: mudanças entre as edições

De Wiki Clusterlab.com.br
Ir para navegação Ir para pesquisar
 
Sem resumo de edição
 
(8 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 1: Linha 1:
*https://github.com/rocko83
*https://github.com/rocko83
*[https://learngitbranching.js.org/ learngitbranching.js.org]
=Atlassian GIT Tips=
*https://confluence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html
=Commands=
==List files==
<pre>
git ls-files
</pre>
=Change name and e-mail=
<pre>
git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email "MY_NAME@example.com"
</pre>
=create a new repository on the command line=
=create a new repository on the command line=
<pre>
<pre>
Linha 9: Linha 22:
git push -u origin master
git push -u origin master
</pre>
</pre>
=Create new branch=
<pre>
git checkout -b sandbox
git add myfile.json
git commit -m "updated myfile.json"
git push --set-upstream origin sandbox
</pre>
=Delete Branch=
==Localy==
<pre>
git branch -d branchname
</pre>
==Remotely==
<pre>
git push origin --delete branchname
</pre>
=MarkDown=
*[https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax Basic writing and formatting syntax]
=push an existing repository from the command line=
=push an existing repository from the command line=
<pre>
<pre>
Linha 18: Linha 50:
git pull origin master
git pull origin master
</pre>
</pre>
=Commands=
=Remember password=
==List files==
<pre>
<pre>
git ls-files
git config --global credential.helper store
</pre>
</pre>
=Bisu da Atlassian=
=Revert a commit=
*https://confluence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html
<syntaxhighlight lang=text highlight=1>
#Careful: git reset --hard WILL DELETE YOUR WORKING DIRECTORY CHANGES
git reset --hard HEAD~1
#or
git reset --hard <sha1-commit-id>
git push origin HEAD --force
</syntaxhighlight>
=[https://stackoverflow.com/questions/1125968/how-do-i-force-git-pull-to-overwrite-local-files Force a "git pull"]=
<syntaxhighlight lang=text highlight=1>
#Careful: git reset --hard WILL DELETE YOUR WORKING DIRECTORY CHANGES
git fetch --all
git branch backup-master
git reset --hard origin/master
</syntaxhighlight>

Edição atual tal como às 17h14min de 7 de novembro de 2023

Atlassian GIT Tips

Commands

List files

git ls-files

Change name and e-mail

git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email "MY_NAME@example.com"

create a new repository on the command line

echo "# JAVALEARN" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/rocko83/JAVALEARN.git
git push -u origin master

Create new branch

git checkout -b sandbox
git add myfile.json
git commit -m "updated myfile.json"
git push --set-upstream origin sandbox

Delete Branch

Localy

git branch -d branchname

Remotely

git push origin --delete branchname

MarkDown

push an existing repository from the command line

git remote add origin https://github.com/rocko83/JAVALEARN.git
git push -u origin master

Pull a repository

git pull origin master

Remember password

git config --global credential.helper store

Revert a commit

#Careful: git reset --hard WILL DELETE YOUR WORKING DIRECTORY CHANGES
git reset --hard HEAD~1
#or
git reset --hard <sha1-commit-id>
git push origin HEAD --force

Force a "git pull"

#Careful: git reset --hard WILL DELETE YOUR WORKING DIRECTORY CHANGES
git fetch --all
git branch backup-master
git reset --hard origin/master