Git Notes
Git 學習筆記。
Git Config
update personal information in: ~/.gitconfig
, as below:
1 | [user] |
Clone repository from bitbucket or github
git clone https://${bitbucket or github}/${account}/${repository}.git
- put a file
README.md
to gtcafe folder. git status
shows git status, you will see the unstaged files in red.git add README.md
, checkgit status
again,README.md
will be staged status.git commit -m 'comment'
commit the file to local- repeat step (2) - (5)
push the data to remote
git remote -v
: list remote repositorygit remote add origin https://bitbucket.org/rick_kyhwang/gtcafe.git
- list remote repository again
git push origin master
: push to master branch in originorigin
is an alias name, you can specify the suitable one to recoginze.
Create a branch
git branch -v
shows the branch listgit branch v0.2.x
creates a branch named v0.2.xgit checkout v0.2.x
switch branch to v0.2.x- update one of files, commit
- create a new file, commit, and push:
git push orogin v0.2.x
- switch to master branch
git checkout master
, check the new file if existing
Create a tag
git tag
shows tag listgit tag -a v0.1.x
create a tag named v0.1.x in localgit push orogin v0.1.x
push local tag to remote
1 | # Sync the branch |