Select Page

How to pull [clone repo] files from github repo to local git
how to pull files from local to repo

how to create branches and delete

**bold text**

### 1. Clone the repo

`git clone`

2. Authenticate your account

“`git config –global [email protected]`
git config –global anj-bookwormhead“`

### 3. initiliaze the files in from your local computer to github

“`echo “# test12” >>
git init

### 4. publish the files to github

poin the cli to the right directory.

“`git branch -M main “`
For the main – you can select which branch tag you want to add the files.

`git remote add origin`
git push -u origin main

Add a documents to cli to github

If you want to add all the files, use .
git add .
git commit -m “2nd commit”
git push origin main

If you want to add specific file.
git add
git add test2.txt
git commit -m “2nd commit”

### …or use remote if the files are not cloone in github

git remote add origin
git branch -M main
git push -u origin main


Option 2: Use this if the files are clone in github
IF you encounter an error

**$ git remote add origin
error: remote origin already exists.**

Check the if there’s a origin existing
$ git remote –verbose

origin (fetch)
origin (push)

git push

git remote set-url origin

## **Github** Branch

“` $ git branch -a“`

**Result example**

* main
* new-branch
* old-branch

**Delete local branch**

“git branch –delete or
“git branch -d mybranch

**Delete remote branch**
“git push origin –delete oldbranch“

It create and switch to the new branch you created
“git switch -c mybranch“

Just switch to other brand

“git switch main