Last active
October 13, 2018 05:32
-
-
Save queirozsc/9e8802ae778cf98a45b1618fd7bedbdd to your computer and use it in GitHub Desktop.
[Manipulando GitHub] #git
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
# Add untracked files + commit changes + push to server | |
git add -A && git commit -am 'Message' && git push ; |
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
# Create a new branch | |
git branch experimental ; | |
# List all existing branches (note: asterisk marks the currently branch) | |
git branch ; | |
# Switch branch | |
git checkout experimental ; | |
# Merge the branch into master | |
git merge experimental ; | |
# View conflicts | |
git diff ; | |
git commit -a ; | |
# View graphic representation | |
gitk ; | |
# Delete a branch ensuring that the changes are already in the current branch | |
git branch -d experimental ; | |
# Destroying a branch | |
git branch -D crazy-idea ; |
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
# Clone your CodeCommit repository to a local repository | |
git clone [CloneUrlHttp] [localrepository] |
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
# View the history of changes | |
git log ; | |
# Complete diffs at each step | |
git log -p ; | |
# Overview of the change | |
git log --stat --summary ; |
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
cd project | |
git init | |
git add . | |
git commit |
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
# Commit to your repository | |
git push origin |
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 reset --hard HEAD^ |
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 checkout cats.html index.html ; |
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
# Inspect what others changed | |
git fetch remote-repo master ; | |
git log -p HEAD..FETCH_HEAD ; | |
gitk HEAD..FETCH_HEAD ; | |
gitk HEAD...FETCH_HEAD ; | |
# Fetch changes and merging into the current branch | |
cd project ; | |
git pull remote-repo master ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment