Git commands tutorial

Hoàng Hải Triều / 09-01-2018

git clone https://github.xxxxxxxxxxx

the working directory will be made at local
git status
get the status (difference…, not the inside the file)
for example, newly created index.html is untracked

git add index.html ( git add -A <- for all files)
add new file for commit
notice newly added content in a file for commit

git status
show status again after added
changes to be committed

git commit -m ” added index.html message”
committed but still on local, not yet synced

git push
Need to log in by an account of git hub and that account is already invited to the repository.
push to git hub

gut pull
must stay in the git directory
all the change will be added to the local file, even conflicted files.
For conflicted files, we have to look, edit and save. then commit again buy [git commit]
== Create brach
git branch MyNewBranch
on local only. MyNewBranch is not yet made on remote.
== Check out
git checkout MyNewBranch
change the meaning of current working folder to MyNewBranch

git push -u origin MyNewBranch
copy to remote, visible on remote.

git checkout master
change local to master

=== Merge (current checking out director is Master)
git merge MyNewBranch
newly added file on origin/MyNewBranch will be copied to local (current folder)

git push -u origin master
the new file will be copied from local to origin master.
On the server/MyNewBranch will have the message “This branch is even with master”

=== Delete branch
git branch -d MyNewBranch
Delete on local only.
On remote it is still there.
git push origin –delete MyNewBranch
This will delete on remote.