Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Here is an example of cloning an empty repository, creating a file, and pushing it back to GitHub:. Some whitespace has been added to make the example flow better and be more readable.

Code Block
languagebash
$ git clone git@github.com:example/example.git
Cloning into 'example'...
warning: You appear to have cloned an empty repository.

$ cd example
$ ls

$ echo "hello, world" > hello.txt

$ ls
hello.txt

$ cat hello.txt
hello, world

$ git status
On branch main

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	hello.txt

nothing added to commit but untracked files present (use "git add" to track)

$ git add hello.txt

$ git status
On branch main

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
	new file:   hello.txt

$ git commit -m "this is a one line commit message"
[main (root-commit) 0f31fb5] this is a one line commit message
 1 file changed, 1 insertion(+)
 create mode 100644 hello.txt

$ git status
On branch main
Your branch is based on 'origin/main', but the upstream is gone.
  (use "git branch --unset-upstream" to fixup)

nothing to commit, working tree clean

$ git push
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 238 bytes | 238.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To github.com:brianlarkinsexample/example.git
 * [new branch]      main -> main
$

Pulling in Updates from the GitHub Repository

...