Table of Contents

GUI

https://gitea.io/en-us/

Init

    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" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/janforman/kingdom-msm8974.git
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 git@github.com:ifad/rest-client.git

# Adding (as "endel") the repo from we want to cherry-pick
$ git remote add endel git://github.com/endel/rest-client.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 https://example.link/repository.git
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

Merge

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

Remove sensitive informations

bfg --delete-files YOUR-FILE-WITH-SENSITIVE-DATA
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