Git checkout master

Hello;

To switch for erpnext branch master, I did the following from /home/frappe/frappe-bench/apps/erpnext:

git fetch upstream master

But when I typed git checkout master, I faced the following error:

error: pathspec ‘master’ did not match any file(s) known to git.

And this is the result of cat .git/config:

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote “upstream”]
url = GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
fetch = +refs/heads/develop:refs/remotes/upstream/develop
[branch “develop”]
remote = upstream
merge = refs/heads/develop

Can someone advise me what should I do?

Regards
Bilal

Are you aware of switch-to-master and switch-to-develop commands?

See bench --help or this Bench Commands Cheatsheet

Hello clarkej;

Thanks a lot for your kindly reply.
Yes I am aware for bench switch-to-master and bench switch-to-develop commands.
And I need to convert to master.
I did the command bench switch-to-master, but this command is not converting the erpnext to master branch, it is only converting the frappe to the master branch.
So how to convert the erpnext branch to master?

Now the situation with me as following:

bghayad@Bilal:/home/frappe/frappe-bench/apps/erpnext$ git status

On branch develop
Your branch is up-to-date with ‘upstream/develop’.
nothing to commit, working directory clean

bghayad@Bilal:/home/frappe/frappe-bench/apps/frappe$ git status
On branch master
Your branch is up-to-date with ‘upstream/master’.
nothing to commit, working directory clean

bghayad@Bilal:/home/frappe/frappe-bench/apps/erpnext$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote “upstream”]
url = GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
fetch = +refs/heads/develop:refs/remotes/upstream/develop
[branch “develop”]
remote = upstream
merge = refs/heads/develop

And the versions are:

Installed Apps
ERPNext: v9.x.x-develop (15b8801) (develop)
Frappe Framework: v10.0.5 (master)

Regards
Bilal

Try this from:
bghayad@Bilal:/home/frappe/frappe-bench/apps/erpnext$
git reset --hard
git pull
git checkout master

cd /home/frappe/frappe-bench/

bench switch-to-master
bench update

In cat >> .git/config
replace
fetch = +refs/heads/develop:refs/remotes/upstream/develop
with
fetch = +refs/heads/:refs/remotes/upstream/
save it and then
try git fetch upstream master
git checkout master

Hello @vishdha

fetch = +refs/heads/:refs/remotes/upstream/

This was giving error, the correct is:

fetch = +refs/heads:refs/remotes/upstream

Now the problem again with git checkout master, as it is giving the below error:

frappe@Bilal:~/frappe-bench/apps/erpnext$ git checkout master
error: pathspec ‘master’ did not match any file(s) known to git.

Kindly find below the output of cat .git/config:

frappe@Bilal:~/frappe-bench/apps/erpnext$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote “upstream”]
url = GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
fetch = +refs/heads:refs/remotes/upstream
[branch “develop”]
remote = upstream
merge = refs/heads/develop

But, I have to mention that I typed git fetch upstream master with the following output:

frappe@Bilal:~/frappe-bench/apps/erpnext$ git fetch upstream master
remote: Counting objects: 224242, done.
remote: Compressing objects: 100% (51391/51391), done.
remote: Total 224242 (delta 174239), reused 221027 (delta 171072), pack-reused
Receiving objects: 100% (224242/224242), 244.22 MiB | 404.00 KiB/s, done.
Resolving deltas: 100% (174239/174239), completed with 2061 local objects.
From GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)

  • branch master → FETCH_HEAD

So: does it means that the master branch is directed to the FETCH_HEAD? Or I am wrong?
In other words, is it required now to type git checkout FETCH_HEAD?

Regards
Bilal

I believe that something related if I downloaded originally the development version or the production version. I need to do enough testing later and I will come back with the final result.
Regards
Bilal

Well, I tried the upgrade for production and it went straight forward without errors.
If the version is development, then I need to upgrade and after that, I have to switch to production. If I need to upgrade again, then I have to switch back to development and then I have to upgrade, if I need to work in production, then I have to switch to production again.

Actually there is a difference in the .git/config between the production and the development version. Maybe this is the reason and maybe not.

Regards
Bilal