I am fed up of having to look up how to make my git repos and upload them, so I am making this page. The man page is here….

Loading Files into a Github Repo Branch

Using the command line on the local system, you will need a means of logging in, I used gh auth login which requires the installation of package gh and I used apt. The following step by step guide came from git-add from github.com which has an example section dealing with the branches.

  1. git clone <repo name>; this brings down the master
  2. git branch <new branch names> # this creates the branch and I believe that it is easier to do it on the command line, than to use the web site to create the branch.
  3. git branch -a, to check it’s worked
  4. git checkout <same branch name as on line 2>, this sets the default branch for push command
  5. git add . # adds the changes to commit buffer
  6. git commit -m “Describing update function”
  7. git push -u origin <new branch name>
  8. git push origin master

Because I was unsure, I created a branch in the web site, which I no longer need, so I deleted it.

Further advice is available here, but was for me less accessible and understandable. Critically it did not document in a way I wanted the checkout command.

Next I need to reset my new branch as the master, git merge performs an addition, what I want to do is different, and I found this on substack.

Loading Files into a Github Repo before I used branches

  1. Use the web interface @ github.com to make an empty repo.
  2. On the development system, issue a git clone command, documented here …. You will need the repo file name from the web page.
  3. On the development system, copy the files to be included into the folder created by the git clone command and make that folder current. i.e. cd $newly_created_folder and then  perform the following commands which are also explained in more detail here…..

ooOOOoo

$     git add .                                    
$     git config --global user.email "john.doe@spammenot.co.uk"
$     git config --global user.name "John Doe"
$     git commit -m "Initial Version"
$     git remote -v || git remote add origin ${REPO_URL} 
$     git push origin master

  1. $ git add .  copies the files to the local copy of the repo
  2. $ git config --global user.email "john.doe@spammenot.co.uk"  which partly establishes identity of author
  3. $ git config --global user.name "Dave Levy"  which partly establishes identity of author
  4. $ git commit -m "Initial Version" commits the changes to the local repo
  5. $ git remote -v || git remote add origin ${REPO_URL}  tests if the remote repo is set and sets it if not
  6. $ git push origin master  moves the files to the remote repo, will require login credentials.

In various places, it advises not to commit until you’ve finished. Also the man page deals with environment variables.

On Branches & Versions

  1. https://itnext.io/the-github-development-workflow-fb48d9bb63f9
  2. https://gist.github.com/nzakas/7633640
  3. https://nvie.com/posts/a-successful-git-branching-model/
  4. https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell

One Comment

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.