After I committed two PDFs using "Git add - a", it led to my next problem, Error 128.
I am very new to this Get Repository thing. I am not sure how to fix it with the Go Daddy Terminal. Any help is sincerely appreciated.
You would need a git stash or a git commit before doing your git pull as part of your manual pull deployment.
Since pull does a fetch+merge, the merge part would fail if your working tree is not clean (meaning they are modifications in progress, not yet committed).
Related
I am working with a friend on an iOS project, and we are using git for versioning, with Xcode. My friend has committed the changes, and I have my changes locally. When I try to commit my changes, I'm getting this error in Xcode:
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
When I try to pull, Xcode warns me about losing my local changes:
How can we simply merge the changes? I've used TFS before, and things were more much easy, we've checked in changes, and got latest, and if there was any conflict we could solve it. We don't need branching etc, we just need to keep our code in sync.
How can I solve this "deadlock" simply as possible? Or in other words, what is analogous to "just checking in/merging/getting latest in TFS" in git? Xcode built-in solutions preferred, without terminal.
UPDATE:
Here is what I get if I type git status at the terminal.
Cans-MacBook-Pro:myappname Can$ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
You have unmerged paths.
(fix conflicts and run "git commit")
Changes to be committed:
modified: BigPostView.xib
modified: BigPostViewController.h
... (many others displayed here)
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: myappname/Storyboard.storyboard
Cans-MacBook-Pro:myappname Can$
You should always be able to commit your changes, since that's a local operation. You'll get an error only when you try to push your commited changes.
In order to push your commit, you'll have to pull your friend's changes first.
I have searched everywhere and tried various solutions but am still getting the error:
Your local changes to the following files would be overwritten by merge
i have nothing to commit as status tells me the following:
# On branch develop
# Your branch is behind 'origin/develop' by 1 commit, and can be fast-forwarded.
# (use "git pull" to update your local branch)
#
nothing to commit, working directory clean
So then I do a git pull, then get the following:
Updating 67020e6..6dd23de
error: Your local changes to the following files would be overwritten by merge:
app/filename.php
Please, commit your changes or stash them before you can merge.
Aborting
But as I have nothing to commit and if I do a git stash I get No local changes to save
So how can I fix the problem and download and update my local machine with my remote amends.
Bit of history incase:
I have to local machines one at home and work I have done the amends at home and pushed them and I am now trying to update my local work machine with these updates.
EDIT UPDATE
As I cannot answer my own question for a while I found what for me solved this answer:
on the branch I wrote:
git reset --hard
Then the pull worked.
While looking around i tried the following that seemed to fix my issue at the time.
While on the branch i wrote.
git reset --hard
Had you ever previously done git update-index --assume-unchanged <file>? That could be a potential reason for your situation.
To fix, you do git update-index --no-assume-unchanged <file>. Then you should be able to stash your changes and continue with the merge.
Faced exactly the same problem. I was used to CVS before I started exploring git. I think running git pull --rebase origin master is the way to go for the kind of workflow that you and I use.
Refer to https://www.atlassian.com/git/workflows#!workflow-centralized for a more detailed explanation. I definitely know the answer is somewhere in that article, but I didn't understand the article completely.
I'm new to Github and I've been using the windows github tool which has proved a great help and handled a lot of things like SSH keys, prompts commits, discard a commit, revert commit, and it has a combined mechanism of pull+merge & push (sync), and a lot!
I'm learning it and trying to get its internal git command level executions. The other day, I merged a hotfix branch and then wanted to delete it -
git branch -d hotfix
I need to know how to delete it from the server as well. What are the git equivalents of the following two actions available in manage branch in the windows tool -
Unpublish a branch - remove only from the server
Delete a branch - remove locally and on server
Another thing I doubt is that the above git command was unable to remove the branch locally. I executed it, it removed the branch (didn't show in $ git branch) but if I restart the tool, the branch was still there! Was that a glitch?
If someone has been using these, can you pls suggest the best approach (I don't want to be totally dependent on the tool, I want to learn git as well).
In addition to
git branch -d hotfix
you also can remove it from GitHub:
git push origin --delete hotfix
You can see more at "How do I delete a Git branch both locally and in GitHub?"
If you have already deleted branches locally, a simple:
git push --prune origin
is enough to clean those same branches on your GitHub repo.
The opposite situation is when you have deleted branches on GitHub, while they are still on your local repo.
In that case:
git remote prune origin
See "cleaning up old remote git branches".
So to make a long story short, I've been working on a web app for the past few months. Recently I had to get a new laptop and cloned the repository from github onto my new machine... However whenever I commit changes to my app and attempt to use git push -u in the app's root directory i get the following message:
To git#github.com:acc/etc.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git#github.com:acc/etc.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
but when I try git pull git#github.com:acc/etc.git master I get a message telling me that the pull was aborted.
From github.com:acc/etc
* branch master -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
config/routes.rb
test/fixtures/users.yml
Please, commit your changes or stash them before you can merge.
Aborting
so then i commit my changes using git commit -m 'fixing' and then attempt git pull again.
however this time I got messages stating that practically all my files had an "Auto-Merging CONFLICT"
am i totally screwed with this particular repository? I'm not really sure what to do since git is still somewhat new to me....
am i totally screwed with this particular repository?
No, but you will have to do a manual merge, since Git can't figure it out. git status will tell you which files need editing. The files themselves contain markers indicating where you should edit. When that's done, git push should work again.
If the changes aren't that big, consider making a copy of the entire folder/project in a different directory outside of the project, then git reset --hard HEAD will wipe out, erase and delete your recent changes.
You can then apply them again individually using your save3d copies for refernce.
Make sure sure you git add before git commit of course.
Finally if you get auto commit merge issues you can always just edit the files manually to resolve.
I'm having a hard time understanding some git/DCVS concepts. Here's what happened:
I created a git project, and imported it from an SVN repo
I made some commits
I wanted to experiment something, so I created a branch called constants-update
I switched to constants-updatebranch, moved some files, deleted others and added many more
I committed to this branch
Now I'm trying to switch to my master branch using git checkout master
I got this error: error: You have local changes to 'src/groovy/Constants.groovy'; cannot switch branches.
My understanding of DCVS is that I can switch branches at will, even if some branch has more or less files than the others, as long as I commit my files. I've tried committing with git commit -a and switching to master branch, but I have the same error.
As a side note, when I commit git warns me that LF will be replaced by CRLF and warns me about some trailing whitespaces also; after I commit I do a git status and a bunch of files always appear as #modified ....
Is this related to git/windows, or I do not understand correctly what it is supposed to happen? I just want to switch to my master branch without losing my changes in the other branch.
Lookup git-stash for changing branches while there are unsaved changes in the current branch.
You are correct in your thinking about how this should work.
However, it sounds like git is having issues with the line endings, and it thinks all your files are modified even when they aren't. I don't use git on Windows, but I was going to suggest the "core.autocrlf" option to make the crlf handling work. However, the following blog entry indicates that this might not be a good idea: http://weierophinney.net/matthew/archives/191-git-svn-Tip-dont-use-core.autocrlf.html
I solved the problem hacking my pre-commit hook (commenting these lines in .git/hooks/pre-commit with a #):
# if (/\s$/) {
# bad_line("trailing whitespace", $_);
# }
Just use the following option in .gitconfig file which resides in your users directory.
[core]
autocrlf = true
And it will solve the issue.