Created
April 23, 2019 12:31
-
-
Save mariohercules/6de86397fc36b68f10a6a3ea886f3621 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GIT Commands | |
git init | |
git remote add origin http://wwwwwwwwwww | |
git add . | |
git commit -a -m "Projeto Final" | |
git config --global http.postBuffer 157286400 | |
git push -u origin master | |
git checkout -b develop | |
git init | |
git remote add origin http://full_url | |
git add . git | |
git commit -a -m "Projeto Final" | |
git config --global http.postBuffer 157286400 | |
git push -u origin master | |
git checkout -b develop | |
## AUTO CHECKOUT TRACKING BRANCH ## | |
for b in `git branch -r | grep -v -- '->'`; do git branch --track ${b##origin/} $b; done | |
git fetch --all | |
#### GIT PUSH ALL BRANCHS | |
git push REMOTE '*:*' | |
git push REMOTE --all | |
git push REMOTE –tags | |
git push REMOTE --mirror | |
However, in addition --mirror, will also push your remotes, so this might not be exactly what you want. | |
#### GIT DELETE | |
git branch -D realm | |
git push hborigin --delete realm | |
Propagate on other machines | |
git fetch --all --prune | |
#### GET DELETE COMMITS FROM LOCAL AND REMOTE | |
git log --pretty=oneline --abbrev-commit | |
git rebase -i HEAD~1 or git rebase -i HEAD~n (increment n value) | |
* change value pick for drop and save | |
git push origin +master | |
#### GIT GET HEAD ID | |
git rev-parse HEAD | |
git rev-parse --short HEAD | |
#### GIT REVERT CHANGES | |
git reset HEAD \* | |
git checkout – | |
git reset --merge | |
OR | |
git reset --soft HEAD~1 | |
#### GIT CREATE BRANCH | |
git checkout -b [name_of_your_new_branch] | |
git checkout [name_of_your_new_branch] | |
git push origin [name_of_your_new_branch] | |
When Local not exists branch | |
git fetch --all | |
git branch [name_branch] origin/[name_branch] | |
#### GIT DELETE BRANCH | |
git branch -d the_local_branch | |
git push origin :the_remote_branch or git push origin --delete the_remote_branch | |
* git fetch -p | |
#### GIT MERGE | |
git checkout master | |
git merge develop | |
git push -u origin master | |
git checkout develop | |
#### GIT RESET | |
git reset --hard HEAD | |
### HACK | |
git add `git status | grep modified | sed 's/\(.*modified:\s*\)//'` | |
### Revert changes | |
git rm --cached -f -- arquivo | arquivos | |
git checkout HEAD -- arquivo | arquivos | |
## Specific commit | |
git checkout 3cdc61015724f9965575ba954c8cd4232c8b42e4 /path/to/file.txt | |
git reset --hard <old-commit-id> | |
git push -f <remote-name> <branch-name> | |
##### SET-EMAIL | |
https://help.github.com/articles/setting-your-commit-email-address-in-git/ | |
GITHUB Username | |
git config user.username "yourname" | |
git config user.name "your full name" | |
git config user.email "your e-mail" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment