Git Guild
August 5, 2020About 1 min
Git Guild
create bare repo
create
git init --bare name.gitchange user
chown git -R name.gitclone repo
git clone git@domain:/home/git/name.gitcreate Initial commit
touch new README.md
echo name >> README.md
git add README.md
git commit -am "Initial commit"push the current branch and set the remote as upstream
git push -u origin masterdevelop
create dev
git checkout -b dev
git branch dev
git checkout devpush dev with upstream
git push --set-upstream origin dev
git push -u origin devclone dev
git fetch
git checkout devcreate feature/0xA1
git checkout dev
git checkout -b feature/0xA1
git checkout -b feature/0xA1 dev
git push --set-upstream origin feature/0xA1
git push -u origin feature/0xA1merge feature/0xA1 then delete
git checkout dev
git merge --no-ff feature/0xA1
git branch -d feature/0xA1remove feature on remote
git push origin --delete serverfixremove feature useless
git fetch -p
git remote prune originrevert & revert on merget . "-m 1" means mainline is 1(dev)
git revert <commit>
git revert <commit> -m 1tag
local & share
git tag tagname <commit>
git push <origin> <tagname>
git push <origin> --tagsdelete & share
git tag -d <tagname>
git push origin :refs/tags/<tagname>
git push origin --delete <tagname>others have to rebuild all tag
git tag -l | xargs git tag -d
git fetchcreate new repo
…or create a new repository on the command line
echo "# ff" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M master
git remote add origin https://github.com/gaoming714/ff.git
git push -u origin master
…or push an existing repository from the command line
git remote add origin https://github.com/gaoming714/ff.git
git branch -M master
git push -u origin master
…or import code from another repository
You can initialize this repository with code from a Subversion, Mercurial, or TFS project.
speed up git
git clone https://ghproxy.com/https://github.com/...
git remote -v
git remote set-url remote https://github.com/...