I want to know how I can resolve merge conflict using git rebase? I use gitlab UI to create merge request. Currently its showing "There are merge conflicts". How to get rid of this error on UI so that the administrator of project merges the "merge request" from UI?
I have new branch called "feature/one" which I am trying to merge into "dev" and ran into conflict issue.
Any help, greatly appreaciated.
If you are alone working on the feature/one, you would rebase it on top of dev locally, resolve the conflict there (meaning locally on your machine) and force push.
That is
git switch feature/one
git rebase dev
# resolve conflicts
git push --force
That would update your merge request automatically.
Related
Has anyone experienced how to add an existing NodeJS API to an existing (Angular) Nx Monrepo?
Unfortunately the manual doesn´t help me so much
https://nx.dev/migration/manual
The process of migrating a repo into your mono repo requires a few manual steps. I think there would not be a simpler way to do it.
Assuming your node project does not share files with your current monorepo, this should be the steps:
on your node repo, create a branch 'to-monorepo' and in it, move all the files to folders that match the nx folder structure and push the commits to it.
remove your package.json file (we will later merge it with the monorepo's one)
once the folders match the nx folder structure, time to merge into the monorepo. From the monorepo add the remote of the other repo
git remote add node-repo <your git repo's node url>
at the monorepo folder, checkout your master
run a pull to make the node repo branches be available in the monorepo
git pull
create a new branch 'merging-node-repo' on your monorepo.
merge the branch node-repo/to-monorepo into your merging-node-repo branch, preserving the history:
git merge node-repo/to-monorepo --allow-unrelated-histories
push your new branch (all the code and its history will now be listed in this new branch)
remove the remote node-repo from your local monorepo configs
git remote rm node-repo
manually merge all the node repo's original package.json file dependencies into the monorepo's one, and run npm install from the monorepo. This way your package-lock.json file is updated. Once you are done, create a commit and push it.
this last step is more tricky. You have now to manually update the monorepo's config files to allow nx to start managing it. This is where the link you had in your question might help. Once you are done, create a commit and push it.
With these steps you can then merge your merging-node-repo branch into master.
I recommend you to create a separated nx workspace with a nodejs project on it. This helps you with having a baseline for all the necessary nx configurations and dependencies.
You might want to make sure your project works via nx commands from this separated workspace; this way you will have a better chance of getting configurations of your monorepo right.
Hopefully this gets you started.
Here is a solution that I wrote and used to import multiple repos into a single monorepo, under whatever subdirectories are wanted, while maintaining commit history:
https://github.com/marcuswestin/monorepo-merge
I've also found two other scripts that look like they might work, but I haven't tried them:
http://choly.ca/post/git-merge-to-monorepo/
https://github.com/ksindi/monoreaper
I have made changes to some css and js file in my Node-React apllication which is deployed on Heroku. But the changes are not showing up when I git add . the project on heroku. ALthough the changes are not coming up when I run the project locally.
Any help would be appreciated on what could be the possible cause on the changes not getting deployed?
You need a few more commands in your deployment workflow.
The git add . command is putting your local changes into staging.
You also need to run git commit -m 'your commit message' in order to commit those local changes to your local git repository.
Next, you need to run git push to push your local repository to the remote repository it is linked with.
Effective use of git is one of the most useful things you can teach yourself as a developer. It will enable you to contribute effectively to a team when the time comes. Here's a good starter article: Basic Git With Examples.
I am trying to update my git repo during the GoCD build. That means that because Go sees another change it triggers another build.
Is it possible to stop the re-triggering of the build?
Background:
I am building and publishing npm packages and I want to automatically increase the prerelease version so I don't have to remember it.
My pipeline looks essentially like this:
npm version prerelease --no-git-tag-version
npm publish
git add package.json
git commit -m "Bump prerelease version"
git push origin
This will update the version in git if the publish succeeds but also triggers another build since Go is polling.
Configure your CD/CI tool to build only when there is a commit to a specified branch or you can probably create a new branch called "pre-release" and configure CD/CI not to build when there is a commit.
Once this configuration is done in the CD/CI tool
npm version prerelease --no-git-tag-version
npm publish
// fetching for other branches
git fetch
// Switching your branch
git checkout pre-release
// Finally committing
git add -m "Your commit message"
git push -u origin pre-release
I hope this works out for you :)
You can configure your stages in your pipeline to be triggered manually, for example, if you where setting up your pipelines as code, in your ${pipeline_name}.gocd.yaml.
- deploy-to-next-stage:
approval: manual <-- You need this!
jobs:
deploy:
tasks:
...
This may help as you could run an automated deploy to a development stage and then manually push successful builds to the next stage (pre-release perhaps). In this way, your builds that worked would not be effected by new builds being triggered by a push to your repo.
Or you could put this on your first stage and your entire pipeline would not be triggered by the push to the repo, but instead by you heading into the GUI and triggering it yourself.
I've created GitLab project by cloning remote repository. During a few days my colleagues pushed their commits to the original repository (not GitLab). Now I did 'git fetch --all' from GitLab repository but commits do not show in GitLab web UI. What should I do to resync GitLab project with its repository? Is there rake task for that? I can't simply recreate the project as we already imported issues from an external source, created labels, milestones, etc.
There is no GitLab feature to fetch the upstream updates. What you did was import an already existing repository, and that is a one time feature.
But you can fetch the upstream updates into your local repository, then push them to GitLab. You'll need to add the orginial/upstream repo as a remote to your local repository by running git remote add upstream {path to original repo}, then fetch the upstream repos by running git fetch upstream, then merge git merge upstream/master, then git push master origin.
GitHub has a decent help section on adding the upstream remote, and doing the merge.
Only the EE version of GitLab has the repository mirroring feature which supports automatically pulling down updates from the import source repository.
If you are using the free CE version, you'll have to manually update or create a custom process.
I installed GithubHQ in one server and GitlabCI in another server. But now I need do integration between GitlabHQ and GitlabCI. When I go to add a new project in GitlabCI he requests a path .git project, but the project is on another server where the GitlabHQ.
I tried use the path remote, like: http://[domain-name]/[user]/[project].git but he not accept.
I researched about how GitlabCI search the path and found that it does not support remote paths. He use "Rugged::Repository.new(path)" just to get the project on the server.
Does anyone know a way to use paths .git remotes in GitlabCI?
As illustrated by Issue 36:
Actually the purpose of gitlab-ci implies that you install it on deployment point. You install it where you deploy your project
So you are supposed to use a local non-bare repo.
You could, in your case, clone your remote repo on the gitlab-ci server, and use that local path.
In order to build an integration between gitlab and gitlab-ci:
add gitlab_ci user to git group for read access
clone your project via git clone /home/git/repositories to somewhere like /home/gitlab_ci/projects/...
add this project to ci.
setup gitlabhq to use ci service
Thats all.
On gitlab push it will trigger gitlab ci to make git fetch origin, so testing repo will be always up to date.