My friend and I have a remote branch in Gitlab. For some reason I got the project from my friend by copy-paste (I know that's a bad thing). But let's say I got the code, did some changes, and I want to initialize git in it and then push a new branch in our project. Like:
- Get the project from my friend
- Do some changes in the code
git init
in the project foldergit remote add origin https://...
git fetch
- In this step, I want to create a branch, say
foo-branch
. Commit my changes, and push it toorigin foo-branch
, with the background commits of master (or any other branch).
What is the right way to do step 6? I have tried that after step 5, I tried git reset master
so I can get all the older commits from master branch but it didn't worked.
I can give more information if you need.
Edit 1: After step 5, I did git reset origin/master
. It seems like it's something to move on, git log
shows all the previous commits. But this time git status
shows all the files even those in the .gitignore
. Any ideas how to do this correctly?