Skip to main content

GIT Basics

Basic commends#

git clone [repository https address] -> download project from remote repository
git pull                -> download changes from current branchgit status              -> status of the local changesgit log                 -> log the historygit add .               -> add all of the changes to queuegit commit -m "Comment" -> approve changes that we can push nowgit push origin main    -> push changes to in this case "main" branch

Branches#

git branch [name]       -> create new branchgit checkout [name]     -> change to the new branch or commitgit checkout -b [name]  -> create new branch and checkoutgit branch -d [name]    -> remove branchgit branch              -> show all of the branches

Rest#

git pull origin [name]  -> download changes from branchgit add [file name]     -> add file to queuegit reset               -> reset queuegit stash               -> stash current local changes and go back to previous commitgit commit -am "Comment"-> add . and commit in the same timegit reset --hard HEAD^  -> reset to previous commit and delate current commit and history (there is no going back if these changes were not pushed yet!)git reset --soft HEAD-1 -> reset to previous commit