Happy Happy to Study Git - MRLIVING/Becca GitHub Wiki
- A folder which includes files and sub-folders
- local repository could be located under various account, instance and folder.
- HEAD is the current revision. Usually, it's the latest revision of the current branch, but it doesn't have to be.
- master is a name commonly given to the main branch
- origin is a name commonly given to the main remote. remote is another repository that you can pull from and push to. Usually it's on some server, like github.
git status
git add ${FILENAME}
git commit
git push
git log -${N} --oneline
git branch
git init
git checkout -b '$BRANCH_NAME'
git add ...
git commit -m ...
git push
git remote add $REPO_NAME $REPO_URL
git push --set-upstream $REPO_NAME $BRANCH_NAME
git clone -b master --single-branch https://github.com/...
git checkout ${BRANCH} -- ${PATH_TO_FILE}
git checkout -b 'v1.0'
git push -u origin ${BRANCH}
git diff origin/master
git diff origin/master -- ${FILEPATH}
git config --global --unset-all user.name
git config --global --unset-all user.email
-
config user name and email in every commit command
git -c user.name='UserName' -c user.email='[email protected]' commit -m "Custom message"
-
config commit user name and email within
.git/config
...
[alias]
commit-a = -c user.name='A Name' -c user.email='[email protected]' commit
commit-b = -c user.name='B Name' -c user.email='[email protected]' commit
usage: git commit-a -m "commit message"
git --author='UserName <[email protected]>'
git --author='UserName <>'
without email
-
Initial commit
-
add index.html with
<h1>hello world</h1>
3.1. add robin.html with <h1>hello world</h1>
@Robin
3.2. add index.html with <h2>hello world</h2>
Merge Local/Remote of the master branch
4.1. add <h3>hi robin</h3>
into index.html in remote @Robin
4.2. add <h3>hi eric</h3>
into index.html in local
Merge Local/Remote of the master branch and Solve conflict
-
create a branch dev in remote
-
add
<h4>hi General</h4>
into index.html under dev @Chin-Sheng
6.1 add <h5>eric again</h5>
into index.html under local master
Merge master/dev branches and Solve conflict