User Tools

Site Tools




    1. Sign on to SSH as root: ssh root@your_nas_ip
    2. Create the folder for your repository:  mkdir /opt/git/what_ever && cd /opt/git/what_ever
    3. Initialise the repository: git – bare init
    4. Exit SSH (exit)
    5. Navigate to the local git project folder: cd projects/etc
    6. git init + Add the remote repo: git remote add origin ssh://root@your_nas_ip/opt/git/what_ever
    7. Populate the remote repository: git push origin master (using your admin password)."

Init repository and push it to origin

echo "# kingdom-msm8974" >>
git init
git add
git commit -m "first commit"
git remote add origin
git push -u origin master

Revert one Commit

git revert <commit hash>

Revert to Commit

git checkout <commit hash>

Show last changes

git show

Discard local changes

git reset --hard
git add .
git stash  

git checkout <some branch>
 Cloning our fork
$ git clone git clone

# Adding (as "endel") the repo from we want to cherry-pick
$ git remote add endel git://

# Fetch their branches
$ git fetch endel

# List their commits
$ git log endel/master

# Cherry-pick the commit we need
$ git cherry-pick 97fedac

git push repository name

git remote add other
git fetch other

Show remote repositories

git remote -v

Create patch

git format-patch -1 HEAD

Apply patch

git apply yourcoworkers.patch
git clone url

Change last revision

git commit -m 'initial commit'
git add forgotten_file
git commit --amend


git fetch upstream
$ git checkout master
$ git merge upstream/master
$ git push

Remove sensitive informations

bfg --replace-text passwords.txt

Cherry Pick External Repo

git fetch <remote-git-url> <branch> && git cherry-pick FETCH_HEAD
git fetch <remote-git-url> <branch> && git cherry-pick HASH

GIT visual guide

programming/git.txt · Last modified: 2021/04/11 10:29 by Jan Forman