We're trying to use Git source control for our NetSuite SuiteScript. How can I synch my Eclipse SuiteScript workspace files with my local git repo if the local repo already contains the files (meaning "Share Project" won't work)?
I've already setup a Git Repo for our NetSuite SuiteScript library. The initial setup was simple because I pulled down our file cabinet using the SuiteCloud IDE (Eclipse/NetSuite bundle), added an existing local git repo, and used the Eclipse Team > Share Project feature to push the SuiteScript files to the repo. However, that method only works the first time through.
Our other developers aren't able to use the Share Project feature to synch the projects with the Repo since the files already exist in both locations. The challenge is that the files need to be pulled directly from NetSuite first in order to have the necessary indexes for the File Cabinet.
I think you should be able to pull files from file cabinet, do git init , commit files to git repo, and then delete the project from workspace. This would ensure the files exists in netsuite and git repo both.
Now, you can take a similar approach as in the case where files existed in both NetSuite and git repo, by creating new project and pulling up the files again from NetSuite and adding git repo info.
I found a way to do this.
Clone your remote repo (can use init too but easier with clone IMO)
Delete all the files in your repo
Pull all the files into Eclipse from NetSuite.
Use Team > Share Project to synch with your repo
Use fetch to reset to the remote repo
git fetch
git reset --hard origin/master
After this you're all set.
Related
Here's the situation, we are currently working on a project and lately we decided to upload it on GitHub. Now I made my changes and I want to push the changes onto the repository.
As far as I read, in order to make changes you need to clone the repository but that will download all files from the repository and I already have all of the source files.
I'm using GitHub desktop and I can't find any option to clone without downloading and update or create branches from my existing files. Creating a local one is an option but it needs to be uploaded as a separate repository instead of linking it to a current one.
Is there any way to push updates, create branches to the repository from my local project to an existing repository?
Your local project should already be a git repo, if you uploaded it to GitHub.
But in case it is not, switch to command-line, and do inside the root folder of your project (which should shows the same files as your remote repo):
git init .
git remote add origin https://github.com/<user>/<project>
git fetch
The fetch part will download the repo but leave your files alone.
(But do a backup still, just to be safe)
git branch master origin/master
git reset master
From there, your GitHub Desktop should show you any diff between your files and what was fetched from the repo.
I have a problem with my project in Eclipse IDE.
For the first time, I worked on an old version and made several changes.
I tried to upload the project on GitLab for the first time I configured Git on Eclipse IDE and I tried to commit and push "but I could do that only after doing a 'Fetch' from the remote branch and commit the 'Merge' change in my local repository.
Because I got this error:
rejected non-fast-forward
I followed this link Egit rejected non-fast-forward to fix it.
The fetch downloaded all the git project files in my project on Eclipse. Until now in my project, I have a subfolder like this: myProject/myProject.
I made several commits and push and it works normally. I figured out that a subdirectory in gitLab docroot is created with every push I make.
This is the local project structure:
This is the project structure on GitLab:
I want to delete docroot/WEB-INF/classes from GitLab.
How to delete this commit from GitLab using git plugin in Eclipse and how to correct my local project structure?
docroot/WEB-INF/classes is a folder. Git does not track folders, only files:
To delete a folder, you have to delete all the files in it.
In the Git Staging view, commit the deletions.
Make sure your current local branch is configured as When pulling: Rebase (in the Git Repositories view right-click the branch and choose Configure Branch...)
Git > Pull to make sure your commit is the latest commit in the upstream branch. If there are conflicts, you have to resolve them in the Git Staging view
Git > Push to Upstream
For details see the EGit User Guide and be aware that old Stack Overflow answers refer to outdated version of EGit.
I'm working on a repository that has two branches: Master, and Release1.
The branch I need is Release1. I went to the site and tried to clone it, but no matter what I did I got the Master branch cloned.
So I gave up and downloaded the branche's zip to my file system. I added it to Eclipse and worked on it.
Now I need to commit my changes. But neither the branch nor the repository show up in my visual tool.
When I try to add a local repository the visual tool tells me the folder is not a repository.
Is there a solution? I have quite a few changes on my local project and I have to commit them.
The Zip download is not a Git repository, it's only a collection of the files at that moment in time. Here's a way you might be able to get your changes into the repository:
Clone the repository properly
Copy your current files into the cloned directory
git status and git diff to check that the changes are what you expect
git commit
When you cloned the repository the first time, you were getting both branches - a Git clone is a fully copy of everything: every branch, all history, etc. The default branch is typically master. After you clone, if you want to switch to the other branch, use git checkout Release1.
What GUI are you using? When trying to clone you have to make sure you change the branch you are cloning from (usually in a drop down menu or you may have to type it in). If you can successfully clone from Master, than you should be able to change to or "checkout" Release1 branch.
Just downloading the zip, just gets you the source code and doesn't have any connection to git. To save and push your changes you will need to clone the repository and checkout Release1
I have downloaded in Windows libray LIB and edited it to suit my needs ie adding some usefull functions that I would like to share with original libraty author.
How ever it seams that I must install some Cygwin in order to have github pull request working and I don't want that.
I want directly to upload my version to orginal repository via browser without needed to login into github and doing all that nasty cloning and such.
Ideally I would like to send with zip my verison of the lib that would create oo the fly new branch to orginal repo and make pull request to master.
Is this possible in github?
Ideally I would like to send with zip my version of the lib
This is not what Git (source control manager) and GitHub (Git repository hosting service) are for.
If you are modifying sources (from the zip archive), you should contribute back to the source repository of that library, through a GitHub fork of said sources.
Again, Git is about managing sources (mostly text files), not artifacts (like a zip of sources).
Artifacts are stored in artifact manager (like Nexus or Artifactory)
If you want to push back to GitHub, you would be pushing back text files, not a aip archive.
How ever it seams that I must install some Cygwin in order to have github pull request working
No: a pull request is entirely done on the server side, through the web GUI, on your fork.
I want directly to upload my version to original repository via browser without needed to login into github and doing all that nasty cloning and such.
You only can push back to your fork, not to the original repo. See "Git fork is git clone?"
Once pushed, you can then create a pull request.
So if you haven't already done so:
fork the original repo (done through the web GUI)
clone that repo with Git (you can use msysgit, no need for Cygwin)
git checkout -b aNewBranch (this doesn't change any file, it just creates a new branch to isolate your changes)
report your changes in it, git add and git commit
git push origin aNewBranch
Then, on the web interface on your fork, select that 'aNewBranch' and create a pull request from there.
See also those "couple of tips for Pull Requests".
I'm an Eclipse user, but I'm a newbie to Mercurial and to Bitbucket. I think I understand the command-line hg commands. I can create repositories, clone, push, pull, update, that stuff.
If I have a project in Eclipse, I can create a local repository for it. I can't figure out how to clone this repository up to Bitbucket.
If I have a project in Eclipse, I can create a remote repository on Bitbucket. Then I don't have a local repository, so I can't use any of the Team... commands, and can't do anything.
If I have a repository on Bitbucket, I can't get to it, because I don't have a local repository, so again I can't do anything.
If I create separate repositories locally and on Bitbucket, then I have two different repositories, and I don't know enough Mercurial to merge(?) different repositories.
There must be some blindingly obvious to get a project off the ground, but I'm blind to it. I can do this just fine from the command line, but MercurialEclipse is defeating me. No luck so far with Google and assorted documentation...
Help?
Doing it using Eclise "Team" UI:
Create a project in Eclipse and "share" it using Mercurial repository type. That will create local repository (by default in the same location where your project is).
Create project repository on BitBucket.
Use "Team">"Push" to push local changes to your remote BitBucket repo. First time it will ask you to enter the repository URL, user name and password. All this information is available on your Bitbucket web UI.
Don't forget that you have to do 2 stage commits after that. Commit in Eclipse UI will commit it in your local repository. In your team perspective's Synchronize view you will see additional "Outgoing" and "Incoming" entries. Using right-click menu on them you will be able to push/pull your changes to/from your BitBucket repo.
Remote repo information can be managed in special "Mercurial Repositories" view.
More info can be found in the tutorials at http://ekkescorner.wordpress.com/blog-series/git-mercurial/
Following the directions provided by bitbucket should be enough.
You can either create a repository on bitbucket and clone it on your desktop:
hg clone https://bitbucket.org/youraccount/yourproject
...
hg pull -u # to pull changes and update
hg push # to push changes to this repo
Or use a local repository and push these changes to a newly created repository on bitbucket:
cd /path/to/existing/hg/repo/
hg add [...]
hg commit
hg push https://bitbucket.org/youraccount/yourproject
Basically, two repositories are "bound" by:
a common changeset in their history
the [paths] configuration in /path/to/existing/hg/repo/.hg/hgrc, that lists remote repositories you can read/push to.