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.
Related
The general question is: how to work with many different git repos at the same time in one intellij project. Where the git repos need to be inside the main application (that is one git repo too). I cannot use symlinks because I cannot commit those
I have 2 git repos
one is for the main app, the other one is for a library I am using in several projects.
Here is how it goes: I have the main app. Via composer I add my library / package to the application.
The problem:
folder structure:
to develop
IdeaProjects/myappA
note: there is are as well IdeaProjects myappB etc
IdeaProjects/mylib
in myappA there is
IdeaProjects/myappA/vendor/mylib
server deploy folder:
/var/www/www.myappA.com/
I do a lot of changes to the library, I have it open as another module when I work on myappA so I do code changes to mylib in that folder / module that actually contains the original source code of mylib. Now i don't want to composer install or update each time I do a tiny change. So what I do is I deploy via intellij the files from the library mylib each time on save directly into the composer install folder of my main application e.g. to IdeaProjects/myappA/vendor/mylib. Now the problem is, I need to deploy it as well to the server deployment folder. But there seems no way to deploy files to two folders out of the box with intellij.
What else can I do?
currently I manually use a short key to trigger an ant build that then copies the folder IdeaProjects/myappA/vendor/mylib to the server deployment directory.
There are multiple solutions depending on your setup:
solution inside intellij: just import mylib as a module inside your myapp project
Go to File > Project Settings > Modules, click the + and choose import module
git native solution: Use submodules
Submodules allow you to keep a Git repository as a subdirectory of another Git repository. This lets you clone another repository into your project and keep your commits separate.
Note that there are some quirks when working with submodules, especially the way to keep the referenced submodules up-to-date
For completeness: if you were using gradle or maven instead of ant, you could use their respective projects views and use the + to add multiple build.gradle or pom.xml files, which would automatically import those projects as modules into intellij.
I think the module approach does fit your case and yes you can have a different git repo per module. Right click on your project root new->module or file->new module from existing source
Intellij should also detect every git repository automatically in your project if you check Settings | Version Control you should see the list.
You can also speed up some operations such as git pull instead of having to pull from every repository (VCS -> Git -> Pull) you can do VCS -> Update Project or ctrl-t (cmd-t on mac)
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.
I have a Git repository which contains an ASP.net application and a PHP application, each in its own subdirectory under the root of the Git repository. I would like to create two websites in Azure websites and deploy each of these applications to one of those websites. I can deploy the ASP.net application with no problem by setting the project variable in the settings panel on the website properties to the path to the CS project file. However I cannot successfully get the PHP site to deploy. I have tried setting the WWWroot directory, but Azure is still trying to build the csproj file even though it is not specified by the variable on that website, nor is it present in the root directory of the Git repository. How can I make the PHP site deploy correctly, without needing to put it in its own repository?
Figured it out: I just set the "Project" attribute in app settings to the directory name of the PHP application, relative to the root of the repo.
In case it helps, I used to do this on a number of my projects, but have since migrated to a new strategy.
Now, I create a git repository for my overall project and repositories for each of the "sub projects" within it. For my Tweet Monkey project, for instance, I have http://github.com/codefoster/tweetmonkey as well as http://github.com/codefoster/tweetmonkey-raspi, http://github.com/codefoster/tweetmonkey-edison, and the website at http://github.com/codefoster/tweetmonkey.io.
Then I link the sub projects into the main project using submodules by typing the following at the command prompt...
git submodule add http://github.com/codefoster/tweetmonkey-raspi
git submodule add http://github.com/codefoster/tweetmonkey-edison
git submodule add http://github.com/codefoster/tweetmonkey.io
That way I can deploy the website to Azure using CI by simply tying up to the tweetmonkey.io repository, but I can also clone the entire project or point other people to the entire project using the http://github.com/codefoster/tweetmonkey link.
Hope that helps.
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?
I have a website which is written in php, jquery. I have just started a repository for it on github, and successfully copied a readme textfile to the site.
How do I (a) integrate the entire website into the git repository? Currently the project_git directory is at the same level as the httpdocs directory. How do I put it inside, but making sure that the website stays up and well?
(b) create a local repository which can push to this site?
Your help will be much appreciated.
Skip the README file for now and copy it.
Create an empty repository on github
git init in the folder where you want to track all your files, e.g. httpdocs
git add .
git commit -m 'first commit'
Add the repo on github as a remote, e.g. git remote add origin < githubpath >
Push up the master branch to github with git push origin master
Now you can add your README, commit and push, or do it in step 3
If you have pushed the README.txt file to github you are all set up (with a local repository). git will not mess with your current directory structure so it should be as easy as:
git add .
git commit -m "first commit of website"
git push origin master
And you should see everything in github
You'll need to provide us with a bit more insight into your file directory structure, and probably what platform you're on would be helpful.
Also note, if you just started a free github account, pushing your site up there will make the source publicly accessible. Just something to consider.
But basically, all you need to do to put the website into github is:
1) Navigate to the root directory of the site
2) Follow the directions on github for creating a bare git repo
3) Run git add ., git commit -m "Initial commit", git push
And you should be done! Especially if you've already pushed things to the site, you've already taken care of the RSA key setup and things :)