I searched for similar questions posted here and on the web, but none of them refer to my case.
In some way, I accidentally created a duplicate local branch as you can see in the attached screenshot. My guess is that I created it somehow when I was working with git stash with multiple stashes.
This duplicate branch appears only locally. And moreover, the command git branch in this repo returns only the master branch.
How can I fix this and remove the duplicate local branch? I do want to keep the tags in their place (and I do see them in GitHub so they indeed exist in origin/master branch although they do not appear here in origin/master). Thank you for your help
Editing due to comments:
Before all that mess I accidentally caused, I only saw a single line in the git graph (the blue one) and the tags appeared on it. there was no parallel line next to it showing the same commits. BTW, I cloned the repo to a new location and there I see what I expect - a single line with the tags appear on it. Moreover, I can't push to git from VSCode, but I do succeed in pushing from gitbash, this makes me wonder whether this is some bug in VSCode.
git log --all --graph --format=oneline --decorate prints the expected proper graph, with no duplication:
For other people facing the same issue.
I'm not sure why it happened but it was caused by the tags created using the git-graph extension in VSCode.
To fix this: manually deleted all tags locally only and then fetch them back using git fetch --all --tags.
Note that if the tag was also pushed separately (possibly create/push by another collaborator), a git fetch --tags would bring it back.
While it was not the case for the OP, the command "Git: Delete remote tag" can help, and is introduced with VSCode 1.75 (Jan. 2023) with PR 170415 from the 2020 issue 104845.
This is available in VSCode Insiders today.
Related
I am working on a Rails project!
Excuse for not adding .gitignore
I have accidentally committed and pushed 'database.yml' in to my feature branch. A pull request was created from the feature branch to master branch a few days ago and is not yet merged. There are multiple commits done as part of this pull request and the commit containing 'database.yml' is the fourth last commit.
Others are also working as part of this project and they are merging the changes to master and we are pulling those changes in to our feature branch in-between. Thus, in our feature branch, we have got commits from others which are done after the faulty commit.
so I wish to do a 'git rm' and 'git push' the same file again to resolve this issue (as the PR is not yet merged). Will that create problem?
If you remove the database.yml that will be another commit on top, and nobody will be affected.
Notice, however, that the database.yml will still be part of the history and can be accessed via git log. If that file contains sensitive information, it will be findable by others.
Delete the file from your local system then add the changes to a commit using
git add <FILE_PATH> command and then commit and push the changes and it should be fine.
The right way to remove it properly is to reverse the changes you made to the file and commit it.
Another, dirtier way, is to open the commit and remove the changes and force push it to the repo. But you need the proper rights for this. Others will also have problems if they try to pull changes then.
My question is very basic but still it is unclear for me. I am working on a rails project with multiple developers. All of them can pull or push the project. So let me explain my scenario. If I am making changes in my code for the first time and the other developers are also making changes, when I try to push the project I am able to do so. But the other developer face problem in pulling the project. After that If they are able to make changes and pull the project then I am unable to push the project or pull the project. This is how we push the project first:
git add .
git commit .
git pull origin master
but the error comes warning: Cannot merge binary files or I get the error git pull fails with “Untracked working tree file 'blah' would be overwritten by merge
The problem is coming because you and your friend doing changes on the same line of the file and git is unable to decide which one to take. So in this case its better to go for stash first to save your code.
The code will be:-
git stash :- To save your code
git pull :- To pull the code from git
git stash apply :- To merge your changes with the pulled files, if any merging error is coming then it will hit an error saying merge-conflict,you have to resolve that manually.
git add :- To add the files
git commit -m "Commit message" :- To commit it
git push :- To push to the repo.
I think this will solve your problem
git checkout accepts --ours or --theirs options for cases like this. So if you have a merge conflict, and you know you just want the file from the branch you are merging in, you can do:
$ git checkout --theirs -- path/to/conflicted-file.txt
to use that version of the file. Likewise, if you know you want your version (not the one being merged in) you can use
$ git checkout --ours -- path/to/conflicted-file.txt
ref:Resolving a Git conflict with binary files
In your case the file is 'blah' in the working directory of remote location. so u can keep one of them.
I'm wondering how this is possible.
I made quite a bit of changes to my rails project (deleted some stuff, edited files, added files, ...) as I implemented a whole new design.
And now I want to commit my project and push it to github
git merge new-view
git add .
git commit -am "implemented the new design"
git push origin master
Now when I pulled the changes on another computer I noticed that not all of my features were working. (for example the image slider wasn't functioning).
When I go trough the files, it looks like all the changes I made are there, but I must be missing something because both projects are not behaving in the same way!
Even when I clone the project again from github (on the original computer with the working projectfolder), the feature still doesn't work.
git clone projectname
Now in my old folder I can't push any other changes as status tells me that my branch is up to date with origin/master
git status
I figure that I can just delete the github project and upload it again, but that's obviously not the way this is supposed to be done.
Any ideas what could've gone wrong?
Make sure that no important files are being ignored- see this answer
Make sure everything is truly committed. git status and git status --cached
Make sure any databases are initialized, migrated and populated with the same data.
Check browser caching.
I'm having an issue with Xcode trying to commit some changes to a Git repo. Today, I created a branch from master in order to work on future updates of an app while keeping the ability to fix the release version.
The problem I have occurs when committing changes. I get the following error message:
error: pathspec 'Furtivus.xcodeproj' did not match any file(s) known to git.
The thing is, back in the early days of the project, I changed the name of the bundle and the project and it is no longer called "Furtivus". I've tried looking into the .git directory where my local repository is located. I've also tried looking for any files containing "Furtivus" on my mac with no results. I can't find where to change this name.
Obviously Git is trying to find the old project that was renamed, so how do I change that?
I've done a lot of searching, in the documentation regarding Git, and on Stackoverflow and nothing seems to cover how to handle Git and a project name change.
This is my first day using Travis CI. I made some mistakes, I've tried removing and adding the repository again, but Travis CI build history is still there, with broken links for old commits.
Any chance to remove those old builds?
You can use the travis command line tool
Login first using travis login then you can do the following
LAST_BUILD_NUMBER=68
for i in $(seq 1 $LAST_BUILD_NUMBER ); do travis logs $i --delete --force ; done
This will remove the "logs" so there's no information aside from the header and any confidential information will no longer be visible.
There's no way for the user to remove builds, but if you really want them removed I think your best bet is to email support (support#travis-ci.org) and ask them to remove it manually.
Per https://twitter.com/travisci/status/557932883571392512
Since at least 2015/01/21 you can now delete [the log] from the web UI:
As henrikhodne, build deletion is not possible.
From https://github.com/travis-ci/travis-ci/issues/877 (mirror) where the issue was raised:
Closing this issue for good, as this isn't on the roadmap for the near future. (Jul 23, 2015)
You can click on the Remove log button
Another way to PURGE EVERYTHING which results in:
removing all the build history from Travis CI
removing the repo from Travis CI
removing the repo data from GitHub (all issues, PRs, wiki, everything)
removing all the dangling commits from git push -f
First make sure you have screenshots/backups/... of all your settings in Travis and in remote repository + that you have a 1to1 mirror of your remote repository (meaning ALL your branches properly downloaded to the local repo). That should be possible just with git clone, git fetch and maybe even git checkout to each of the branches, so that you have all the history available locally (correct me if I forget some step).
Then you want to go to your remote server e.g. GitHub and delete the repository (Settings - Danger Zone - Delete this repository). All your issues, PRs, wikis, any settings are gone now. Then create the same-named repository on GitHub again (do NOT! initialize it with anything, no license, no readme, no nothing).
Now all the dangling commits which would be cleaned locally via git gc are gone from the remote repo (stealthy GitHub links begone!). Anything that should be the bare repo.git folder should be overwritten (unless GitHub isn't doing something silly).
Proceed and go to Travis CI profile:
https://travis-ci.org/profile/<username>
Press Sync account under My account and check the Travis repo. All the settings and build history should be gone now too.
Now either remove the GitHub repo and resync again or proceed with the restoring:
git push -u origin <branch name> # repeat for each branch
Go to your settings backups (e.g. screenshots) and set everything the way it was before.
I was able to wipe the Travis build history simply.
I'm logging into to travis-ci.org via my Github account.
I went into travis-ci-org, and hit the + to show all repositories:
Then I turned off Travis CI for the repo in question by flipping this toggle:
In Github, I renamed my repo.
Then I hit "Sync account" in the upper left.
For my final step, I flipped that toggle back on under the new repo name.
Voila - no Travis history. I triggered a build manually and now everything is clean and clear.