tags:

views:

25

answers:

1

Hello, I have been using git but not to an advance level because it's just me who pushes the commit to the github server and so i know any conflicts that arises if any. Now there's another developer working in another part of the world who also pushed some updates to the github repository.

My problem is most of his work are not yet production-ready so I just want to go to my last commit and push my updates there so that when I do a capistrano deploy , I'll be quite sure that the code is production-ready. How can I do this?

+3  A: 

You can checkout a particular commit using the command:

git checkout <commit-id>

Now, if you want to do more commits over this, you'll need to create a new branch:

git checkout -b <branch-name> <commit-id>
Siddhartha Reddy
Do i need to reclone the repository, and the do the checkout , and then git add and then git commit (as i normally would) ?? im really confused
r2b2
There is no need to clone the repository again, you can work off your current clone.
Siddhartha Reddy
r2b2, I suggest that you go through some git tutorials and understand branching in greater depth. A lot of the power of git lies in easy branching.
Siddhartha Reddy
@Reddy: well, actually you could also do `git checkout <commit-id>` and work on detached HEAD / unnamed branch, and only when you decide that the changes are worth keeping create a new branch for them via `git checkout -b <branch-name>`. Just FYI.
Jakub Narębski
@Narębski, Thanks. `git checkout <commit-id>` also prints out a help message that gives essentially that same information.
Siddhartha Reddy