git commandds code example

Example 1: git common commands

git init
//add all
git add .

//cancel adds
git reset

//cancel commits
git reset HEAD^
//cancel last 3 commits
git reset HEAD~3

//when first commit
git push -u origin master

//remove remote origin
git remote remove origin

//reset remote origin
git remote add origin https://github.com/yourname/project.git

Example 2: git basic commands

git branch -d <branchname>

Example 3: git basic commands

git commit -m "Commit message"