Right now my method of using git is to develop a website locally and when it's looking good, to git push origin master
and then ssh into the server and git pull origin master
. I'm curious if there's a way to easily change versions of an app. So say I've added a couple features and then want to remove them for a little while. How could I go back without just removing the code?
Asked
Active
Viewed 141 times
2

Matthew
- 15,282
- 27
- 88
- 123
-
You've gotten a variety of answers, because your question isn't totally precise. Do you want to remove those features locally, in your development repository, just for testing, say? Or do you want to remove them from the publicly available stable (deployed) version? – Cascabel Apr 10 '11 at 16:09
3 Answers
1
You can use git checkout X
, where X is a tag name, or a commit ID. To see the commit you want to go back to, you can use git log
.
(Beware, this will put you in a detached HEAD, so don't do any commits until you used git checkout master
to go on top of the master branch again.)

Artefact2
- 7,516
- 3
- 30
- 38
0
Add the features on a branch, then pull that branch from the server. When you want to revert to the trunk just do that. When the features are ready, merge the branch into the trunk.

drysdam
- 8,341
- 1
- 20
- 23
0
So long as you have been versioning the files in question, I think what you are talking about has been covered here - Rollback file to much earlier version using Git
and here - Reset or revert a specific file to a specific revision using Git?