This shows you the differences between two versions of the page.
— | programming:git [2021/04/11 10:29] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== GUI ====== | ||
+ | [[https:// | ||
+ | ====== Init ====== | ||
+ | < | ||
+ | 1. Sign on to SSH as root: ssh root@your_nas_ip | ||
+ | 2. Create the folder for your repository: | ||
+ | 3. Initialise the repository: git – bare init | ||
+ | 4. Exit SSH (exit) | ||
+ | 5. Navigate to the local git project folder: cd projects/ | ||
+ | 6. git init + Add the remote repo: git remote add origin ssh:// | ||
+ | 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 README.md | ||
+ | git commit -m "first commit" | ||
+ | git remote add origin https:// | ||
+ | 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> | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | | ||
+ | $ git clone git clone git@github.com: | ||
+ | |||
+ | # Adding (as " | ||
+ | $ git remote add endel git:// | ||
+ | |||
+ | # Fetch their branches | ||
+ | $ git fetch endel | ||
+ | |||
+ | # List their commits | ||
+ | $ git log endel/ | ||
+ | |||
+ | # Cherry-pick the commit we need | ||
+ | $ git cherry-pick 97fedac | ||
+ | |||
+ | git push repository name | ||
+ | |||
+ | git remote add other https:// | ||
+ | git fetch other | ||
+ | </ | ||
+ | |||
+ | ====== Show remote repositories ====== | ||
+ | < | ||
+ | git remote -v | ||
+ | </ | ||
+ | |||
+ | ====== Create patch ====== | ||
+ | < | ||
+ | |||
+ | ====== Apply patch ====== | ||
+ | < | ||
+ | git apply yourcoworkers.patch | ||
+ | </ | ||
+ | |||
+ | |||
+ | < | ||
+ | git clone url | ||
+ | </ | ||
+ | |||
+ | ====== Change last revision ====== | ||
+ | < | ||
+ | git commit -m ' | ||
+ | git add forgotten_file | ||
+ | git commit --amend | ||
+ | </ | ||
+ | |||
+ | ====== Merge ====== | ||
+ | < | ||
+ | git fetch upstream | ||
+ | $ git checkout master | ||
+ | $ git merge upstream/ | ||
+ | $ git push | ||
+ | </ | ||
+ | |||
+ | ====== Remove sensitive informations ====== | ||
+ | < | ||
+ | < | ||
+ | |||
+ | |||
+ | ====== Cherry Pick External Repo ====== | ||
+ | < | ||
+ | git fetch < | ||
+ | |||
+ | [[http:// |