Skip to content

Instantly share code, notes, and snippets.

@marceloxp marceloxp/
Last active Aug 9, 2019

What would you like to do?
GIT Commands

GIT Commands

Auto login

# ~/.netrc
  login user_login
  password user_passwords


gedit ~/.bashrc
export PATH=$PATH:/home/umstudio/dev
chmod +x /home/umstudio/dev/


Command Description
git status List the files you've changed and those you still need to add or commit
git add * Add all pending files to staging
git reset HEAD <file> Unstage file
git commit -m "comentários" Commit files
git push origin master Push commited files


Command Description
git branch List local branchs
git branch -r List remote branchs
git branch -a List local and remote branchs
git diff --name-only provisorio..master | zip -@ Create Zip
git branch merged master lists branches merged into master
git branch --merged lists branches merged into HEAD (i.e. tip of current branch)
git branch --no-merged lists branches that have not been merged
git log --all --full-history -- **/thefile.* list file inside history


Command Description
git config --global advice.statusHints false Remove Hints


Command Description
git reset --soft HEAD~1 Undo the last commit - keep changes
git reset --hard HEAD~1 Undo the last commit - remove changes

Remote repositories

1 - git remote add local-alias-name
2 - git fetch local-alias-name master
3 - git push local-alias-name HEAD:master


  • How to fix GitKraken Inotify Limit Error - upgrading Ubuntu/Linux inotify limits
echo 99999 > /proc/sys/fs/inotify/max_user_watches

Rename Branchs

git branch -m old_branch new_branch         # Rename branch locally    
git push origin :old_branch                 # Delete the old branch    
git push --set-upstream origin new_branch   # Push the new branch, set local branch to track the new remote
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.