I have a repository A, and a clone of it, named B. Then, I have edited a file in the A and not commit it. My question is if I can run git pull
in B to get the edition in the A?
views:
148answers:
3
+3
A:
If no "commit and push" was performed, how can a client pull
get access to new revisions?
Short answer: no.
jldupont
2010-02-08 14:08:25
You don't need a push to perform a pull on B. But that doesn't change the answer.
Tomas Markauskas
2010-02-08 14:12:08
@Tomas: of course, provided that the repo isn't empty ;-)
jldupont
2010-02-08 14:14:03
A:
If you don't want to commit the file to the master branch, commit it to another branch and pull that.
Christoffer Hammarström
2010-02-08 14:19:02
+1
A:
You can only pull revisions, i.e. commits. If an edit isn't committed, it isn't in the repository and can't be pulled. However, you could do something like
- Commit the edits in repository A
- Pull them to repository B
- In repository A,
git reset --hard HEAD^
to undo the latest commit and erase the edit.
If you want to keep the edit in repository A but not the commit, omit the --hard
option to reset
.
calmh
2010-02-08 14:36:10