git clone https://github.xxxxxxxxxxx
Ex: https://github.com/thunghiem123/demo-project
the working directory will be made at local
git status
get the status (difference…, not the content 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 (not only new file, but also the file you just edited)
notice newly added content in a file for commit
git status
show status again after added
changes to be committed
git commit -m “whatever message or comments”
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 branch
git branch MyNewBranch
on local only. MyNewBranch is not yet made on remote.
git checkout -b hotfix/bs-XXX
create hotfix/bs-XXX branch and move to that branch
git branch
showing all local branches. Branch with * is active branch.
for example
issue1
* master
== Check out
git checkout MyNewBranch
change the local active branch to MyNewBranch
git push -u origin MyNewBranch
copy to remote, visible on remote.
git checkout master
change local active branch 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.
Ref: https://backlog.com/git-tutorial/stepup/stepup2_3.html