-
-
Save Niknafs/09b9866cfa70c04f49ed 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
# if get recieve.denyCurrentBranch error try to pull from | |
# the repository instead of pushing. Alternatively just | |
# switch to a tmp branch. | |
# Permanently going back to previous commit | |
git reset --hard 123abc | |
# Checkout a previous commit into a separate branch | |
# without a branch name it will be in a headless state | |
git checkout -b old-state 123abc | |
# set the remote URL | |
git remote set-url origin ssh://newhost.com/myproject.git | |
# add a local directory to push | |
git remote add local /my/dirs/ | |
# Describes simple add/remove tags in Git | |
# Add a tag | |
git tag -a v1.0.0 | |
git push origin --tags | |
# Delete a remote tag | |
git tag -d my_tag | |
git push origin :refs/tags/my_tag | |
# add all files to staging | |
git add . | |
# switch branch | |
git checkout mybranch | |
# create new branch | |
git checkout -b newbranch | |
# delete a branch | |
git branch -d badbranch | |
# list all branches | |
git branch | |
# change configuration for repo | |
git config --local user.name "UserName" | |
git config --local user.email "UserEmail" | |
# change global config | |
git config --global user.name "UserName" | |
git config --global user.email "UserEmail" | |
# clone a gist and then merge changes from a forked gist | |
git clone git@gist.github.com:2322786.git # clone some random gist | |
git remote add changes git://gist.github.com/2661995.git # register remote of a forked gist | |
git fetch changes # get those changes | |
git merge changes/master # merge them | |
git push # update the gist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment