./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.com
Global:
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.com
git log --decorate=full --graph
git checkout -b alt-branch
...
git commit
git checkout fin-branch
git merge --no-ff alt-branch
git remote -v
git remote add upstream {remote.git}
git fetch upstream
git checkout main
git merge upstream/main
git 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-branch
git fetch ; git reset --hard origin/release
git branch newbranch
git reset --hard origin/master
git checkout newbranch
Create 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 diff
Two commits ago:
git diff HEAD^^
or:
git diff HEAD@{2}
Single file:
git checkout -- fn
Everything in a repo:
#!/bin/bash
for f in `git ls-files -d`
do
echo restoring $f
git checkout -- $f
done
git config --global credentail.helper 'cache --timeout=3600'
git credential-cache exit
git remote add origin https://github.com/user/repo.git
git remote -v
git clone --recursive https://github.com/user/repo
git submodule update --init --recursive
Create (add) a new commit that applies the inverse operation of the given <SHA>
.
git revert <SHA>