git
Table of Contents
Git is a version control tool
1. utilities
1.1. commit with message
git commit -m "message"
2. Basic Workflow
2.1. create branch
https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches
- create local branch
- terminal
git branch branchname
from the branch you want to start off (git branch will duplicate the current branch and give it a new branchname). If the branch is already created in the remote, checkout to its tracking-branch, and branch from there - magit
b l checkout local branch
orb c create branch
would let you decide which branch/tracking-branch to start off.
- terminal
- push local branch to origin(remote repo) and create it at the remote repo
2.2. pull request
pull request is basically telling a project maintainer to pull your code to try it out on their local machine, and decide if to merge.
In order to do that, you need to provide with project maintainer the following informations:
- your repo’s url and the start/end commit of your patch, for the project maintainer to perform
git pull
Esssentially, it is not part of git’s utility, and in its whole done by people by hand: you send message to the project maintaner about your patch, project maintainer try it out and tell you to change something, reject it, or merge it.
git book have this example
$ git request-pull origin/master myfork The following changes since commit 1edee6b1d61823a2de3b09c160d7080b8d1b3a40: Jessica Smith (1): Create new function are available in the git repository at: https://githost/simplegit.git featureA Jessica Smith (2): Add limit to log function Increase log output to 30 from 25 lib/simplegit.rb | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
the command generates this message for you to include in your email to the project maintainer. The git repository is not meant to be local repository, but a public one that the project maintainer would have access to(you can tell from the domain name)
In various git service providers, they made services to make pull-request in the same platform which is roughly like this, just they have buttons to automate some of the commands listed here:
git checkout -b userblah-test master (added master here and in the next line) git pull https://github.com/userblah/myproject.git master look at changes git checkout master git merge userblah-test git push
- mainly pulling and merging
2.3. new repo
2.3.1. start from scratch
best to clone from remote.
- start a repo from sourcehut/github/codeberg…
git clone ssh-link-to-git-repo
2.3.2. git init on a existing project
- create remote
- get in the project
git init
git add .
(note if there’s in-project)git commit
(first commit)git remote add origin ssh-link-to-git-repo
git pull --allow-unrelated-histories
git
Backlinks
old index
(Tools, skills and cheatsheets)
Stuff under doc directory.
- cheatsheet
- web technology
- keyboard for all
- speaking english
- tridactyls
- note-taking
- dance
- sleep
- memory skill
- documentation
- org-roam : This braindump’s working mechnism.
- org-ref
- org-mode
- lilypond
- emacs
- visualization
- playing game on linux
- git
- docker
- youtube-dl
- tailscale
- rime
- planning
- using chatGPT
- finding resource