One question please
I have a project on git with differents branches:
Master Pre Dev ....
I've installed my project files in another server by FTP (not by git pull or git clone) ir order to create a dev enviroment.
The folder of the project in dev enviroment don't have a git repo. Can I set that this folder is a existing repo (dev branch) without do a git pull or git clone?
At the top of your repository on GitHub.com's Quick Setup page, click to copy the remote repository URL. In Terminal, add the URL for the remote repository where your local repository will be pushed. Push the changes in your local repository to GitHub.com.
The steps to follow in order to push new Git branches to remote repos such as GitHub, GitLab or Bitbucket are as follows: Clone the remote Git repo locally. Create a new branch with the branch, switch or checkout commands. Perform a git push with the –set-upstream option to set the remote repo for the new branch.
For example, let's say that you want to change the URL of your Git origin remote. In order to achieve that, you would use the “set-url” command on the “origin” remote and you would specify the new URL. Congratulations, you successfully changed the URL of your Git remote!
Go to your project folder. Add a remote origin
with your existing repository URL.
$ git init
$ git remote add origin <existing-repo-url>
$ git checkout -b dev # checkout a new branch 'dev'
You need to stash (clean working tree and save changes temporary box) your changes before pull the master
. Stash the changes and Pull master
branch changes/commits.
$ git add .
$ git stash save 'local changes'
$ git pull origin master # pull 'master' into 'dev' branch
Now, retrieve/pop local changes from stash.
$ git stash apply # return the code that cleaned before
$ git commit -m 'message'
$ git push -u origin HEAD # push to remote 'dev' branch
Once all is ok then, clean the stash (optional).
$ git stash drop
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With