On Wed, Jul 15, 2020 at 05:36:52PM -0700, SJW wrote:

> I set up a remote git repo on my server for staging.
> Added a remote on local
> Created a new branch 'staging'
> 
> Went to push staging repo to staging remote and got:
> 
> remote: fatal: You are on a branch yet to be born

The problem is that you did not show us what command you run,
and what the situation before you did that looked like.

You know, it's hard to make educated analysis when the problem description
looks like "went on to do stuff".

> So I googled and got the solution - I connected to the remote server and 
> changed the HEAD to the 'staging' branch 

That piece of advice was obvions BS, sorry.

> Then I tried to push again:
[...]
> Git is harder than actually programming!!!!

Please refrain from such whining.

There are two points to this.

First, is that you're venting on a communication venue which is used by unpaid
folks to help other folks solve their problems with using Git.
This kind of suggests these folks consider using Git to be fun, so statements
like yours may easily alienate whoever could help, which, in turn may lead to
at least ignoring your problem or to plain backlash.
No one needs that; nor you nether we.

I mean, if you have an irresistible urge to went on this topic, please use
your social media account(s) and/or blog platforms to do that.
Here, let's keep it calm and to the point.

Second, I assume you do not do programming by "I googled and got a solution"
(I really do). Before embarking on programming using some programming
language, one usually consumes several manuals and/or books on it and may be
works through some courses and whatnot, right?

With Git, as with any other tool intended to flexibly solve complicated tasks,
the approach is basically the same: read the docs, do some practice, rinse
repeat - until it all clicks in.
You could start with [1].

Here is a quick rundown of creating a bare remote repository, a normal local
repository, recording a commit in the latter, pushing it to the former and
inspecting the result.

----------------8<----------------
~$ cd ~/tmp

tmp$ mkdir git
tmp$ cd git

git$ mkdir remote
git$ cd remote
remote$ git init --bare
Initialized empty Git repository in /home/kostix/tmp/git/remote/

remote$ cd ..
git$ mkdir local
git$ cd local/
local$ git init .
Initialized empty Git repository in /home/kostix/tmp/git/local/.git/

local$ git remote add staging ../remote

local$ touch foo.txt
local$ git add foo.txt 
local$ git commit -m 'Add foo.txt'
[master (root-commit) ca7e998] Add foo.txt
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 foo.txt

local$ git branch -M staging
local$ git push staging staging
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 221 bytes | 221.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../remote
 * [new branch]      staging -> staging

local$ cd ../remote/
remote$ git branch -a
  staging
remote$ git ls-tree -r staging
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391    foo.txt
----------------8<----------------

 1. https://git-scm.com/book/en/v2

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/20200717161525.gzyf74pzlpmjunxb%40carbon.

Reply via email to