I have downloaded a Zip folder of Master branch from a gogs
repository and after initializing git
in that folder, I have added my own branch and made my own changes.
Now my question is, do I have to CLONE the project in order for adding a new branch to the repository on gogs
or I can simply add my branch using this way (which is downloading zip folder) ?
Download a zip archive of a remote Git repository (be it a gogs one, or any other remote hosting service), means downloading a snapshot view of the default HEAD.
There is no history.
The history you have created by initializing a local repository in it, and creating a branch, has no common base with the one from the original remote repository.
If you want to push back your local branch, you need first to:
That is:
cd /path/to/local/repo
cd ..
git clone https://gogs/me/myRepo myClone
cd myClone
git are remote repo ../repo
git fetch repo
git switch -c newBranch
git cherry-pick repo/localBranch~n..repo/localBranch
git push -u origin newBranch
In "repo/localBranch~n
", replace "n
" by the number of commits you had created in your local branch.