Uploading an existing source to Bitbucket - php

Okay here's the overview. There's a Laravel 4.0 project in Bitbucket. I want to update this to version 4.1 so a Branch was created. I downloaded the Branch, but did not do the changes to that Branch. I kept is in a separate folder, downloaded a fresh new copy of Laravel 4.1 and moved the necessary files from the 4.0 Branch to the fresh 4.1 source. And changed the config settings as well.
Now I want to commit this fresh project back. Can someone please tell me if its possible to upload the fresh 4.1 project as a brand new Branch? If so how to do it?
I have downloaded the SourceTree as well. If you can tell me how to do it through the GUI, its even better. Either way is fine though.
Thank you.

use cherry-pick or rebase:
How to copy commits from one branch to another?
or rename your branch with:
git branch -m old_branch new_branch
and push this with:
git push origin your_branch_name -f
you can go to an existent branch and get your commits from another branch using git cherry-pick commit-hash-here, or if your changes are not commited, you can stash your changes using git stash and unstashing the changes in the other branch (executing git stash pop)
Are you asking for that?

Related

Jenkins trying to delete the PHP project

We created a clone from the dev server for the jenkis CI to improve our work, we configurated it and the tests started working as we wanted. Then we find out that the git plugin in the jenkins is not liked with the project's workspace. It's a PHP REST api project, every server has it's own configuration. So we gave to the jenkins the path of the project to use that - this is the "Checkout to a sub-directiory" option. Then when a new PR is created, then jenkins is tiggered and it's start the build, and at first it's trying to delete the complete workspace.
I wouldn't think that it would be impossible to run tests on an already existing project with the jenkins, but this is ablosutly not the way how to do it. Every server has it's own configurations, so those are not part of the git repo, plus there is a base installation for the framework, and that's also not part of the git repository.
Now my question is what information are we missing, and how could we configure the git pluggin to make the jenkins start working on our existing project?
Ensure that you have the GitHub plugin and Git Pull Request Plugin installed in your jenkins workspace, now all you have check these 2 option
Also note that you have to add your public in Git which you would have done I'm guessing, now a hook will be created and you can send a request from Git and if you have a green tick ALL GOOD, else you have to debug it try this link Github webhook URL config issue? How to fix it?

Setup PHP project using PhpStorm, Git, SourceTree, Bitbucket

I am trying to stick this all pieces together, so I have:
Remote:
Dev server, where Http Server + DB + my site - folder, where all files of my future project will be.
Bitbucket account
Locally installed:
PhpStorm
Git
SourceTree
What would be a queue of actions to setup all this stuff to make them work together in right way?
Problems I faced:
If I first create PHP project then I can't clone repository from Bitbucket to not empty folder.
How to tie existing project to newly created repository of Bitbucket? Because usually project starts with creating some skeleton from git, so I can't start with empty project folder...
Imagine I make changes, save it to remote server, check it works, then commit it to Bitbucket then I realize I need back to code which was few commits before.
How could I roll back my project code? And then how will I update this on a remote server? Do I need delete all files and upload them again from project?
Problem 1:
Normaly you start with a local project and push it to the remote but it works also the other way round, checkout the remote repo to your computer and then copy the project files into that folder, then use SourceTree to commit and push them.
Problem 2:
You don't rollout commits, you rollout tags and branches. Best is you start with a master branch where you have everything that works 100% and when you develop and work locally you have a second branch develop for testing. When your tests and stuff in develop branch work, you merge it into the master branch. If you want to go a step further, try git-flow.

How to merge a none git directory with 90% same files into a repository

I started a web project without git.
Now I created a project on bitbucket and commited the a backup from 10 days ago. That means a local copy created with git init add and so one but the latest changes were 10 days in the past.
On my webserver is the current version in about 10% of all files have changed but there is no git initialised at the moment.
So now I want to push all files from my server to the master branch so that I can see the differences.
But how do I accomplish this if the new version is neither a clone nor a seperate branch but just the same folder and file structure as my git repos master with a few changes.
Well I like to switch completely to git but I need to visualize the diffrences between the old and the current version for other developers :(
Any idea?
Thank you
Given a working directory with master checked out, you simply copy the files from the webserver onto it. git diff will show you the differences. If you do git add . && git commit "as per webserver", you'll sync your master with the webserver.

NetBeans git subfolders as branch

I have project in NetBeans as this:
I created GIT repository of test project as master branch.
Question:
How can I have each subfolder as branch of project test ?
Note: I am using GIT in NetBeans and http://bitbucket.org as remote GIT.
Thank you in advance.
In the Git philosophy, the concept of branch isn't linked to the notion of folder (like it is in SVN).
When you checkout on a specific branch in a Git repository, you are not moving into another directory. You stay where you were, then Git updates the files in the directory so as to reflects the files of the new branch.
So to obtain the arborescence you want, it implies to clone the project several times.

How to share git branches that are based on same repository?

I am a novice programmer, and completely new to GitHub. I am collaborating with a colleague on a project he has been working on over the years.
So Far:
He created a repository and loaded up all the initial files. I forked it into my account, so that I could work on it separately.
Now:
How can I make a commit to my repository and share it with him, so that he can check out the changes and incorporate them into his repository IF he likes the changes?
I know there is a lot of information on GitHub, but I'm not even sure where to start. Any help is greatly appreciated.
Clone
Make Changes and Track it
Commit
Push to your github repo
Pull to your friends repo
Recommended approach in your case is collaborating with your friend.
Here is how:
Add a collaborator
Read this: Will give you basics of git and how to collaborate with others.
There are many ways to do this, github recommends pull requests and unless you have no push access to the repository you will need to do this or send patches. There is an example of such a workflow here
git clone git#github.com:<their repo> [optional folder name]
cd reponame (or optional folder name)
If the repository has submodules then
git submodule update --init (if the repo has submodules)
git submodule foreach 'git checkout <their working branch>'
Fork the code. Fork the specific repository you plan to work on. This will give you your own copy of the project. Set up git in the repository you plan to work on.
cd <repo dir or optional one chosen)
git remote set-url origin git#github.com:<your github name>/<your repo>.git
git remote add --track next upstream git://github.com/<their github name>/<their repo>.git
That is your repository set up to help with code. You can do git pull, git push, etc. (this will be to/from your fork). To pull in changes from a branch of the partner repo, just do:
git pull upstream branch
You will not be able to git push to their repo, for that you need to do a pull request.
When you are happy then go to github (your project) and select diff and pull request. This allows you to put in a message and the lib maintainer will get a message to attend to the request. It will also show if your pull request will merge cleanly, it is unlikely to be accepted if the maintainer has to fix code.

Categories