git checkout -- .
Reverts some.txt
file changes from the last commit (to discard changes in working directory)git checkout -- some.txt
HEAD will be detached and pointed towards the commit (to go back to master git checkout master
should be run)git checkout b4ba3088679ff70b45df2aefc7c0a13d41a2bd76
Reverts all changes (from the specified commit)git checkout b4ba3088679ff70b45df2aefc7c0a13d41a2bd76 .
Reverts some.txt
file changes (from the specified commit)git checkout b4ba3088679ff70b45df2aefc7c0a13d41a2bd76 some.txt
To switch to an existing branchgit checkout another_branch
To switch to a new branchgit checkout -b new_branch
git commit -m 'Initial commit'
Adds all the modified and deleted files to staging area and then saves changes to local repository with messagegit commit -a -m 'Initial commit' / git commit -am 'Initial commit'
Makes changes to the last commit, adds some files or edits commit messagegit commit --amend -m 'Initial commit'
git config --global user.name "John"
git config --global user.email "johndoe@gmail.com"
Check if we have set the Git username and email globallygit config --global user.name
git config --global user.email
Set username and email for a single repositorygit config user.name "John"
git config user.email "johndoe@gmail.com"
Check if we have set the Git username and email locally (for a single repository)git config user.name
git config user.email
pwd
also works on windows
cd /Users/Brad/Desktop/Sites
Instead of typing the full path we can drag the folder on top of our command line
git remote -v
Add remote repository URL$ git remote add origin https://github.com/tandilashvili/testproject.git
Setting remote repository URLgit remote set-url origin https://github.com/tandilashvili/testrepo.git
git push
try{
$stmt = $conn->prepare($query);
$stmt->execute($exec_arr);
} catch(PDOException $e) {
if($e->getCode() == 23000){
array_push($errors, 'Technology already exists');
} else {
array_push($errors, 'Database error');
}
}
git clone
Initialize local Git repositorygit init
Add files to staging areagit add
Check status of working treegit status
Save changes to local repositorygit commit
Pull latest commits from remote repositorygit pull
Push local commits to remote repositorygit push