GIT: mudanças entre as edições
Ir para navegação
Ir para pesquisar
Linha 55: | Linha 55: | ||
git reset --hard <sha1-commit-id> | git reset --hard <sha1-commit-id> | ||
git push origin HEAD --force | 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> | </syntaxhighlight> |
Edição das 17h12min de 7 de dezembro de 2022
Atlassian GIT Tips
Commands
List files
git ls-files
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