git tutor
Posted on .
Keep in mind it's possible some of the information to be out-of-date.
# git config --global user.name "User Name"
# git config --global user.email "user@name"
# git init
# git add file
# git commit file -m "commit message"
# git remote add origin /path/to/repo
# git remote set-url origin /new/path/to/repo
# git push -u origin master
# git tag -a 1.2.3.4 -m "tagging message"
# git push origin --tags
# git tag -d 1.2.3.4
# git push origin :refs/tags/1.2.3.4
# git checkout branch_name
# git push -u origin branch_name
# git clone /path/to/repo
# git branch new_branch
# git checkout new_branch
# git commit
# git config sendemail.to "list@repo.org"
# git format-patch master
# git send-email --suppress-cc=self 0001-fix.patch
# git push origin --delete oldbranch
# git checkout squashed_branch
# git rebase -i master
pick fda59df commit 1
pick x536897 commit 2
pick c01a668 commit 3
edit
pick fda59df commit 1
squash x536897 commit 2
squash c01a668 commit 3
# git checkout master
# git pull
# git checkout branch
# git rebase origin/master
# git fetch origin pull/[ID]/head:[user]/[branch]
# git checkout user/branch
# change commit message
# git rebase -i HEAD~commit_count
# s/pick/edit/ on commit
# git commit --amend
# git rebase --continue
# git remote add origin https://username@stash/scm/PROJECT/repo.git
# git remote set-url origin https://hostname/USERNAME/REPOSITORY.git
# git submodule update --init --recursive
# git config --global user.name "User Name"
# git config --global user.email "user@name"
# git init
# git add file
# git commit file -m "commit message"
# git remote add origin /path/to/repo
# git remote set-url origin /new/path/to/repo
# git push -u origin master
# git tag -a 1.2.3.4 -m "tagging message"
# git push origin --tags
# git tag -d 1.2.3.4
# git push origin :refs/tags/1.2.3.4
# git checkout branch_name
# git push -u origin branch_name
# git clone /path/to/repo
# git branch new_branch
# git checkout new_branch
# git commit
# git config sendemail.to "list@repo.org"
# git format-patch master
# git send-email --suppress-cc=self 0001-fix.patch
# git push origin --delete oldbranch
# git checkout squashed_branch
# git rebase -i master
pick fda59df commit 1
pick x536897 commit 2
pick c01a668 commit 3
edit
pick fda59df commit 1
squash x536897 commit 2
squash c01a668 commit 3
# git checkout master
# git pull
# git checkout branch
# git rebase origin/master
# git fetch origin pull/[ID]/head:[user]/[branch]
# git checkout user/branch
# change commit message
# git rebase -i HEAD~commit_count
# s/pick/edit/ on commit
# git commit --amend
# git rebase --continue
# git remote add origin https://username@stash/scm/PROJECT/repo.git
# git remote set-url origin https://hostname/USERNAME/REPOSITORY.git
# git submodule update --init --recursive