Skip to content

Instantly share code, notes, and snippets.

@hugsbrugs
Last active May 17, 2016 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugsbrugs/d193b3995b400ca5cfc3 to your computer and use it in GitHub Desktop.
Save hugsbrugs/d193b3995b400ca5cfc3 to your computer and use it in GitHub Desktop.
Git Commands Memo
# Create repo on your server
cd /var/www/website
git init
git config user.email your@name.com
git config user.name Your Name
git remote add origin git@github.com:GitUser/repo.git
# GIT HOW TO UNWATCH SOME FILES (logs, config ...)
# http://stackoverflow.com/questions/9794931/keep-file-in-a-git-repo-but-dont-track-changes
# First change the file you do not want to be tracked and use the following command:
git update-index --assume-unchanged FILE_NAME
# and if you want to track the changes again use this command:
git update-index --no-assume-unchanged FILE_NAME
# List git-ignored file (optionaly filter result with grep)
git ls-files . --ignored --exclude-standard --others | grep mail
# List untracked files (optionaly filter result with grep)
git ls-files . --exclude-standard --others | grep mail
git reset file/to/overwrite
git checkout file/to/overwrite
# pour mettre des modifs faites involontairement en master dans develop
git commit
git rebase master develop
## Contributing
# Fork it ( https://github.com/[my-github-username]/manet_client/fork )
# Create your feature branch
git checkout -b my-new-feature
# Commit your changes
git commit -am 'Add some feature'
# Push to the branch
git push origin my-new-feature
# Create a new Pull Request
git flow hotfix start x.x.xh1
# do your changes
git add -A
git commit
git flow hotfix finish x.x.xh1
git push --tags
git checkout master
git push origin master
git checkout develop
# begin release
git flow release start x.x.x
# publish release
git flow release publish x.x.x
# to follow release (option)
git flow release track x.x.x
# update some file version
nano -w package.json
nano -w bower.json
git add -A
git commit
# end release
git flow release finish x.x.x
# push tags
git push --tags
# send new master branch to remote
git checkout master
git push origin master
git checkout develop
# Change branch to gh-pages
git checkout -b gh-pages
# Rebase branch with master
git rebase master
# Push changes
git push origin gh-pages
# get back to master branch
git checkout master
# Save file changes and get back to last backup
git stash
# Restore saved stash
git stash apply
# List all stash
git stash list
# See stash content
git stash show stash@{2}
# Apply one particular stash
git stash apply stash@{2}
# Delete stash
git stash drop stash@{2}
# Shortcut
git stash pop = git stash apply + git stash drop
# Create a branch from a stash
git stash branch stash@{2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment