Last active
March 3, 2017 13:17
-
-
Save javasteve99/ef14bdf107a79a403085 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 PUSH | |
$ git status $ g st // checks status of your current repo and branch | |
$ git add -A $ g aa // add all changed files to commit | |
$ git commit -m “message” $ g c “message” // commit to branch with commit message | |
$ git pull —rebase $ g plre // rewinds your commit, pulls previous commits from others, commits your changes | |
$ git push $ g ps // pushes files to master | |
$ git status $ g st // should now say “nothing to commit (working directory clean)” | |
# GIT BRANCH new feature branch | |
$ git checkout -b feature-branch-name // creates new branch and checks it out | |
$ git push -u origin feature-branch-name // pushes branch to central repository as a remote tracking branch | |
# GIT MERGE branch into master | |
$ git checkout master // switch into master | |
$ git pull // pull down latest changes to master | |
$ git checkout branch-name // switch into feature branch | |
$ git rebase master // rebase feature branch against master | |
$ git checkout master // switch into master | |
$ git merge branch-name // merge feature branch into master | |
$ git push // push merged local master to remote | |
# GIT DELETE feature branch that has been merged | |
$ git push origin :branch-name // delete remote branch | |
$ git branch -D branch-name // delete local branch | |
# GIT RESET to old commit | |
$ git reset —hard <commit number> // revert local copy to previous commit | |
$ git push -f origin // push local copy to repo | |
# GIT PUSH master branch to gh-pages branch | |
$ git checkout gh-pages // go to the gh-pages branch | |
$ git rebase master // bring gh-pages up to date with master | |
$ git push origin gh-pages // commit the changes | |
$ git checkout master // return to the master branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment