git –version – Insert the missing part of the command to check which version of Git (if any) is installed

git init – Initialize Git on the current folder

git config user.name – Set the user name for the current repository

git add index.html – Add index.html to the Staging Enviornment

git add -A – Stage all new, modified, and deleted files. Use the shorthand command

git commit -m “First release!” – Commit the changes to the current repository with the message “First release!”

git status –short – Check the compact version of the status for repository

git commit -a -m “New line added” – Commit the updated files directly, skipping the staging environment

git log – View the history of commits for the repository

git status -help – Show the possible options for the status command in command line

git help –all – Show all git possible commands in command line

git branch hello-world-images – Create a new branch called hello-world-images

git checkout -b hello-you – Create, and move to a new branch with the name hello-you

git merge hello-you – Merge the hello-you branch with the current branch

git branch -d hello-you – Remove the hello-you branch from the local repository

git remote add origin https://github.com/x/y.git – Add a remote repository as an origin

pull is a combination of fetch and then merge

git fetch origin – Get all the change history of the origin for this branch

git merge origin/master – Merge the current branch with the branch master, on origin

git pull origin – Update the current branch from its origin using a single command

git push originpush the current branch to its default remote origin

git branch -a – List all local and remote branches of the current Git

git branch -r – List only remote branches of the current Git

git clone https://abc.com/x/y.git – Clone the repository: https://abc.com/x/y.git to your local Git

git clone https://abc.com/x/y.git newlife – Clone the repository https://abc.com/x/y.git to a folder named “newlife

git remote rename origin upstream – Rename the origin remote to upstream

*.temp – In .gitignore add a line to ignore all .temp files

temp/ – In .gitignore add a line to ignore all files in any directory named temp

temp?.log – In .gitignore add a single line to ignore all files named temp1.logtemp2.log, and temp3.log

*.log
!main.log – In .gitignore, ignore all .log files, except main.log

git remote add ssh-origin git@abc.com:x/y.git – Add a new remote named ssh-origin connecting to x/y.git on abc.com using SSH

git remote set-url origin git@abc.com:x/y.git – Replace the remote URL for origin with x/y.git on abc.com using SSH

git log –oneline – Show the log of the repository, showing just 1 line per commit

git revert HEADrevert the latest commit

git revert HEAD –no-editrevert the latest commit, skipping the commit message editor

git revert HEAD~1revert the two last commits

git reset abc1234reset to the commit with the hash abc1234

git commit –amend -m “Updated index” – Amend the previous commit to with the message "Updated index"