This document is a cheet sheet for Git & GitHub commands that i find it usefull
Commands
- git init = when starting a new project, use this to initialize git in there;
- git status = shows what needed to be commited, witch branch you on etc;
- git add . = add everything to stage, ready for commit, (.) everything;
- git commit -a -m = -a for all changes, -m for quick message;
Description
- gh-pages = this is not command, its a branch name to use github pages - it must me named like this to work.
Commands
- git branch = use it to show the available branches, and witch one you using it;
- git checkout [branch name] = switch between branches or create new one if the name does not exist;
- git checkout -b [branch name] = create new branch and switch to it;
- git branch -d [branch name] = to delete branch (wont allow if is no merged);
- git branch -D [branch name] = force delete a branch (even if is not merged);
- git checkout --theirs -- [path name] = when you have conflict of blob, and want to select the other branch instead of the master, --theirs used to say the other branch, and add the path name, the add it to stage + commit
Commands
- git merge = you need to be in the dir that you want to recive the files;
- git branch --merged = show what branches have been merged;
- git branch --no-merged = shows witch branches has not been merged;
Commands
- git status = no changes in both branches that;
- git checkout = the branch that you want to pick from it;
- git log = find the commit full number and copy it;
- git checkout = the branch that you want to recive the picked commit;
- git cherry-pick = you are done, if you get conflicts resolve them manualy;
Commands
- git checkout -- . = discard(delete) all uncommited changes in current branch;
- git branch -m [new-name] = rename the current branch;
- git branch -m [old-name] [new-name] = rename some other branch;
Commands
- gs = shortcut for git status (custom zshel)
- gl = shortcut for git log (custom zshel)
- gaa = shortcut for git add . (custom zshel)
- gc = shortcut for git commit -a -m (custom zshel)
- gcm = shortcut for git checkout master (custom zshel)
p.s: with = starts the comment about the command, dont write that part = ...;