April 22, 2023

Beginners guide to git hub

I have always had a lot of difficulty with github.

I have jotted down a few things which might help some new kernel builders.

A. Github Setup

  1. Go to github and Open a new Repo
    I called mine “physwizz_kernel”
  2. To set up SSH key

$ git config –global user.email “you@example.com”
$ git config –global user.name “Your Github Name”

$ ssh-keygen -t rsa -b 4096 -C “you@example.com”

Press enter 3 times

$ eval “$(ssh-agent -s)”
$ ssh-add ~/.ssh/id_rsa
$ sudo apt-get install xclip
$ xclip -sel clip < ~/.ssh/id_rsa.pub

  1. The SSH key will be in clipboard
    Go to github settings => SSH and GPG keys
    New SSH key

Paste key here

B. Using github

  1. Open Terminal In The Kernel Folder

$ git init
$ git remote add origin (github id) mine is git@github.com: physwizz/physwizz_kernel.git
$ touch README
$ git add README
$ git add –all
$ git commit -m “Initial commit”
$ git push -u origin main

If you don’t see the files on the GitHub repo you might need to
$ got commit -a
$ git push origin main -f

  1. To cherry pick a commit from another github repository

firstly add the other repository to your kernel
$ git remote add other https:
$ git fetch –all
$ git cherry-pick [hash_id]

$ git config merge.renameLimit 999999
To cherry-pick a range of commits
$ git cherry-pick [first hash_id]^..[last hash_id]

Sometimes you get extra lines of text in one of the files that should be deleted. The log on screen will tell you which file is corrupt.
Search the file for odd lines like this.

Txt txt txt txt

correct the errors and type
git commit -a
ctrl-o enter ctrl-x
git push origin main -f

git cherry-pick —continue

  1. to push changes to github

$ make clean && make mrproper
$ git add –all

if the change is your own

$ git commit -a -m “message”


$ git commit -a

write comment
ctrl o (to output)
ctrl x (to exit)

$ git push origin main

if the change is a cherry pick
$ git commit “change made” –author=”Author’s name”

$ git push origin main

  1. If it doesn’t work or if you want to try something else

$ git revert
$ git push origin main

$ git reset –hard < last clean commit hash >
$ git push origin main -f
$ git cherry pick
$ git push origin main

  1. to edit last commit

$ git commit –amend -e
$ git push origin main

  1. Don’t use
    $git add –all
    after you build

Leave a Reply

Your email address will not be published. Required fields are marked *