git init
: initialize a git repository
git remote add origin https://github.com/akcgjc007/avl_tree.git
: Connect your git to an existring online repositorygit remote -v
: Show connected repositories
git add .
: Add all files present in the current directory.git add <filename>
: Add a particular file.
git commit -m "Commit message"
: Commiting currently staged changesgit commit -a -m "Commit message"
: Staging and commiting alll current changes
git pull
: Will pull the changes done by other collaborators
git switch <existing-branch>
: Will switch to a branch that already exists.git checkout -b <non-existing-branch>
: Will create a new branch for you.
git branch -d <branch>
: delete the local branchgit push -d origin <branch>
: delete the online branch
git push
: Push current commitsgit -f push
: Forced push commits, will remove any conflicting changes
git stash
: Will remove all uncommited changesgit reset --hard
: Go back to the previous commitgit reset --hard HEAD~3
: go back to three commits beforegit reset --hard HEAD^^^
: go back to three commits beforegit reset --hard <commit-hash>
: go back to this specific commit
- Add a
.gitignore
file into you directory, and name any files and folder that you don't want to commit myFolder/
: Will ignore all files inmyFolder
*.png
: Will ignore allpng
files in the current directory
git remote remove origin
: Remove the online associations from gitrm -rf .git
: Will remove all associations of git