| ./dev |
|
Original theme by orderedlist (CC-BY-SA)
Where applicable, all content is licensed under a CC-BY-SA.
|
Local:
$ git config user.name
abevoid
$ git config user.email
abevoid@abevoid.com
$ git config user.name abetusk
abetusk
$ git config user.email abetusk@mechaelephant.com
abetusk@mechaelephant.com
$ git config user.name
abetusk
$ git config user.email
abetusk@mechaelephant.comGlobal:
$ git config --global user.name
abevoid
$ git config --global user.email
abevoid@abevoid.com
$ git config --global user.name abetusk
abetusk
$ git config --global user.email abetusk@mechaelephant.com
abetusk@mechaelephant.com
$ git config --global user.name
abetusk
$ git config --global user.email
abetusk@mechaelephant.comgit log --decorate=full --graphgit checkout -b alt-branch
...
git commit
git checkout fin-branch
git merge --no-ff alt-branchgit remote -v
git remote add upstream {remote.git}git fetch upstream
git checkout main
git merge upstream/maingit checkout -b x-branch
...
git commit
git push -u origin x-branch
git checkout release
git merge --no-ff x-branch
git commit
git push
...
git branch -d x-branch
git push origin :x-branchgit fetch ; git reset --hard origin/releasegit branch newbranch
git reset --hard origin/master
git checkout newbranchCreate a branch but don't switch to it. Remove local commits back to origin/master. Now switch to the new branch and continue work.
Local changes since last commit:
git diffTwo commits ago:
git diff HEAD^^or:
git diff HEAD@{2}Single file:
git checkout -- fnEverything in a repo:
#!/bin/bash
for f in `git ls-files -d`
do
echo restoring $f
git checkout -- $f
donegit config --global credentail.helper 'cache --timeout=3600'git credential-cache exitgit remote add origin https://github.com/user/repo.gitgit remote -v
git clone --recursive https://github.com/user/repogit submodule update --init --recursiveCreate (add) a new commit that applies the inverse operation of the given <SHA>.
git revert <SHA>