silentw
silentw

Reputation: 4885

NetBeans + FTP + BitBucket

I know this has been asked before, but I couldn't get the answer I needed.

Currently I'm developing an website using PHP and was using Notepad++ before, and it all worked well because I'm developing with a co-worker so we both keep on changing different files on the FTP.

Switched to NetBeans. All went ok, pulled the entire website via FTP to my local computer and everytime I edited a file and saved it uploaded to the FTP. But, there is a problem. If my colleague updates a file, it doesn't update on my local folder. So, I thought: "Let's try versioning".

Created a team on bitbucket, created a repository. All went ok.

But now, I'm in a struggle to get everything up and running on both NetBeans (mine and colleague's) so that my colleague is editing a file on his NetBeans and constantly saving so that it gets saved on FTP and only when he stops working on that file push it to BitBucket so that I can pull after.

Suggestions?

Upvotes: 3

Views: 2604

Answers (3)

LeGEC
LeGEC

Reputation: 51850

About setting up your work environment :

  • In order to set up your bitbucket repository and local clone, go read this link (official doc).
    You will need to repeat the cloning part once for each PC (e.g : once on yours, once on your colleague's).
    Read the account management part to see how you can tag your actions with your account, and your colleague's action with his own account.
    Start using your git workflow ; when you are tired of always typing your password to upload modifications to your bitbucket account, take the time to read the ssh keys setup part - read carefully, you will need to execute the procedure once for you and once for your colleague.

  • Using your local git repository with Netbeans is pretty straightforward :
    From netbeans, run the File > New Project ... command (default: Ctrl+Shift+N),
    Select PHP application with Existing Sources and click Next >,
    For the Sources Folder: line, select your local git directory,
    Fill the remaining fields, and if you want the last Run configuration screen, then click Finish.
    After the project is created in netbeans, you can modify the Run configuration part by right clicking on the project's icon, selecting the Properties menu entry, and going to the Run configuration item.

About solving your workflow "problem" :

Your current FTP workflow can lead you to blindly squash your colleague's modifications (when uploading), or have your colleague's modification blindly squash your own local modifications (when downloading). This is bad, and you will generally notice it only after the bad stuff happened - too late.

Correctly using version control allows you to be warned when this could potentially happen, and to keep an almost infinite undo stack on the modifications of the project's files. The cost, however, is that both of you will have to add several actions in your day to day workflow - some choices can not be made automatically.
You may find it cumbersome in the beginning, but it really pays off, and quite quickly - we're talking big bucks here. So use it and learn.

On top of using Ctrl+S to save your modifications on disk, you and your colleague will need to integrate 3 extra commands in your daily work :

  1. Save your work to your local repository (git add / git commit)
  2. Download the latest modifications shared by your colleague (git pull)
  3. Upload your work to the central repository (git push)

You can access these commands :

  • from a terminal,
  • from a GUI frontend : you can try TortoiseGit for windows, or gitk for linux,
  • from Netbeans :
    • in the contextual menu of the files/folders in the project tree (right click on the item, there is a "Git" entry),
    • using the Team > Git > ... menu

Upvotes: 2

Pedro Polonia
Pedro Polonia

Reputation: 2694

You can create git or Mercurial repositories in Atlassian Bitbucket (http://bitbucket.org). If your team is new to version control, i advise you no forks in your first project.

The easy solution ins to use Atlassian SourceTree (http://www.sourcetreeapp.com/) to control your code since there is a bug in netbeans. See NetBeans + Git on BitBucket

You need to create a new repository in bitbucket. I assume you already configure the ssh2 keys. Using Git you need:

git clone --bare --shared php_project php_project.git

git commit

Using Mercurial you need:

hg init

hg commit

Good luck / boa sorte

Pedro

Upvotes: 1

eckes
eckes

Reputation: 67057

Since you provided a tag, I'll describe what's to do for Git.

  1. set up a remote bare repo on a server that you both could access (BitBucket in your case):
    http://git-scm.com/book/en/Git-on-the-Server-Getting-Git-on-a-Server
  2. you both clone that remote repo to your local machines:
    http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository#Cloning-an-Existing-Repository
  3. each of you works in her part of the application. When one is done, publish the work to the server:
    http://git-scm.com/book/en/Git-Basics-Working-with-Remotes#Pushing-to-Your-Remotes

By now, the remote server holds the version that was just pushed. What's missing is the deployment of the website. This has been discussed here: Using GIT to deploy website

Doing so, you will decouple your work from that of your colleague since you're not changing files over FTP all the time. You work in your part, your partner works on her part. The work is getting merged and then a new version of the website gets published.

Upvotes: 2

Related Questions