Search code examples
gitdeploymentgit-pushgit-pull

git - changing versions of code?


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?


Solution

  • 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.)