Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

Git - revert repo to previous commit, when current code deployed went wrong

0 votes
23 views
added Nov 18, 2021 in Git by lcjr Second Warrant Officer (6,570 points)

This usually happened when current push or deployed code is contains error. Best thing to do? revert to previus commit.

git log 

// the following logs appear and choose which to use e.g
commit 31eb090365b9d177880f66beee2312ad2e130e3a (origin/master, origin/HEAD, master-bak, master)

//checkout to new commit point to revert temporarily
git checkout 31eb090365b9d177880f66beee2312ad2e130e3a

 

Another method is, create bak branch e.g

git branch master-bak

//once master is bad, checkout to master-bak, the previous state of commit. 

 

Please log in or register to response this reference.

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...