Our git remote repository is not synchronized with local repository - java

we have a problem with pushing our local stuff to a remote bitbucket repository.
we are doing commit and push but the changes do not appear in our remote master branch.
Here is the problem in the Git History view of eclipse:
Could somebody please explain to me the difference between refs/remotes/origin/master and refs/heads/master?

In my experience the eclipse git plugin ( in matter of fact most IDE git plugins) is not very reliable. So I would suggest you to try using git command line or some 3rd party solutions like TortoiseGit and try pushing again.

refs/remotes/origin/master contains the SHA-1 of the commit that your local repository believes is the latest on your branch master in your remote origin. It is updated when you communicate with the remote.
refs/heads/master contains the SHA-1 of your latest commit on your local branch master.
See Git references for more info.

Related

commit file from a web application (spring boot) into git remote repository without first cloning the repo as local? is this possible

I am sure this must have been solved before, but I could not get a concrete example.
I have a web app which is taking input from user for some config mgmt and creating an XML. The XML is supposed to be checked into a git repo.
Being new to Git a little clueless, all examples point that we need to have a local repository cloned on disk before doing a git add and finally a git commit and git push.
My question is can't we avoid cloning locally and do a git commit and git push programmatically (java) for that given file [myrepo/config/my-config.xml]
Any example really appreciated.
No, you can not do commit and push without local repository.

How to push using SVN in Eclipse

I'm using SVN to sub-versioning in Eclipse. I can update and do commit as well, but I'm not finding where I can do a push to the remote branch.
Can anyone help me please?
svn commit pushes your changes to the remote server. There is no distinction between commit and push in SVN, as you don't have local repositories there like in Git. Therefore, you are only talking to one repository, which is the remote one.

Merge local Java project to existing git repo

I have checked out the source from a git repo, because i was forced to use someone elses svn repo for a while, and now i want to re-check in my source in the original git repo. We are using eclipse (STS) for the project. The perfect solution would be to check in the changes made during this time into a new branch and then putting back together everything.
Does anyone know how I can do this?
If you have your changes made in one folder, you can use that folder as a working tree in order for your git repo to detect and add those changes.
cd /path/to/git/repo
git --work-tree=/path/to/other/repo status
git --work-tree=/path/to/other/repo add .
Then you can commit and push normally from your git repo now updated with the latest changes from the other repo.
Note: that is a command-line solution: once done, you can resume working in Eclipse.

relative path from pom.xml does not get resolved when using git

I have a strange issue which I guess comes from git. In one of the poms in the projects I'm trying to build there's a call to some source-generator with a config-argument like ${project.build.sourceDirectory}/../resources/config/variables.properties (Note the ../ to get to some upper directory). Everything was fine until I merged the master to the branch. This is when the build of this module started to fail with
[ERROR] Failed to execute goal some.package.maven.plugins:runtime-configs-generator:1.1:generate (generate-runtime-config) on project runtime-configs: /home/user/development/workspace_primary/configs/runtime-configs/src/main/java/../resources/config/files.properties (No such file or directory) -> [Help 1]
my setup: I'm locally using git and dcommit to a remote svn repository.
It seems like the file can't be found anymore. Strangely there are no changes in the relevant parts of the files after the merge.
I next tried to merge by using svn just to make sure the files are exactly the same as with the git merge.
Then I commited the merge I did with git to the subversion repository and did a fresh checkout using svn. It builds with no problem. However when using the git repo I still get the same error.
I tried to delete the local git branch and recreated it again from the remote refs. Still it does not build with the error. First I thought it might be an issue with my terminal/shell (terminator with zshell) having a problem with relative paths, but then why it built before the merge and why it builds from the svn checkout but not from the git directory? When I replace the relative path in the pom.xml with something like
${project.basedir}/src/main/resources/config/variables.properties
it also runs from the git directory though.
Can anyone explain this weird behavior, I'd love to understand what I'm missing.
Something must have been broken in the git repo... I restored an older version from a backup, did git svn fetch && git svn rebase and it's working fine now

Fetch from one git server and push to another server using Jenkins

I have a local git server (centOS) where everyone pushes their work to that repository. Jenkins manages to build whatever in that repository is, overnight. Lately I've got a Git Enterprise account. I've been wondering if there's any way to force Jenkins to 1) Only pulls the code from the local server and 2) Whenever a build was successful, sends the code to git enterprise remote repository.
I'm using Jenkins v. 1.458
well, one option would be to just create a script that does this from bash...but...
You can just add two git repositories under the "source code management" section after installing the Multiple SCMs plugin, and then specify that you want to build REPOLOCALNAME/branch, and then at the end under 'Git publisher' specify you want to merge and push to the remote branch. (ie. BranchToPush=branchname and TargetRemoteName= REMOTEREPONAME)
*Remember, the names are specified under advanced options of the repository when you add it under the SCM section.
*I haven't tested this, there is a chance that it might let you only pull and push, from and to the same repository.
You could set up the push to Github as the last build step that is only run after everything else has succeeded and use the normal mechanisms for retrieving the code from the local git repository. There is no plugin that has this functionality at the moment.

Categories

Resources