How to update the GIT remote repo
Update to the new repo
git remote set-url origin <new repo>
Check the current origin
git remote -v
After we moved to the new repository… run this command to clean up deleted branches
git fetch -p
Update to the new repo
git remote set-url origin <new repo>
Check the current origin
git remote -v
After we moved to the new repository… run this command to clean up deleted branches
git fetch -p
เมื่อเพื่อนเราได้ commit และ push ของเขาขึ้นที่ repository เรียบร้อยแล้ว เราจะเรียก branch ที่อยู่ใน server เราเรียกว่า remote branch และเราเมื่อต้องการ checkout remote branch เราจะใช้คำสั่งนี้ เพื่อ update branch จาก repo มาก่อน checkout remote มาที่เครื่องเรา ที่มา https://www.freecodecamp.org/news/git-checkout-remote-branch-tutorial/
ใน git ปกติแล้วเราต้องการลบ branch สามารถใช้คำสั่งด้านล่างได้เลย แต่ถ้าได้ข้อความจากgit บอกว่า the Branch xxxx is not fully merged. เราก็ต้อง -D แทน -d เพื่อเป็นการ force delete error: The branch ‘xxxxxx’ is not fully merged. References: How to Delete a Git Branch Both Locally and Remotely
It’s needed to encrypt passwords of PROD or even NON-PROD when they’re in configuration files. Jasypt is used as a tools to encrypt/decrypt password in our application. And it can be done from command line. Here we go Encrypt Then you’ll see Decrypt Then, you got the password back Links https://github.com/jasypt/jasypt
คือเดี่ยวนี้มีโปรเจคย่อยเยอะแยะ เกือบๆสิบโปรเจคอยู่ใน folder เดียว เราอยากจะ run command เดียวแล้ว git pull โปรเจคทั้งหมดภายในคำสั่งเดียว ทำยังไง ก็ทำไงแบบนี้ไง จะรันผ่าน command line หรือใส่ sh file ก็ได้นะ
เมื่อเราต้องการสร้าง tag ที่เป็นเหมือน label แปะไว้สำหรับ version ใด vesion หนึ่ง เช่น เมื่อเรา deploy prod ที่ version ไปแล้ว เราอาจจะอยาก tag เพื่อให้รู้ว่า deploy prod ที่ version ไหน นี้คือคำสั่งสำหรับสร้าง tag Create a tag For examle หลังจากลอง list tag ออกมาโดยใช้คำสั่งนี้ List tags และเมื่อต้องการ push tag ที่หา remote ใช้คำสั่ง Push tags to remote
บางครั้งอาจจะเคยเจอว่าเครื่องของเราไม่สามารถ git pull อะไรได้ ขึ้น warning บอกว่า .ssh/known_hosts อยู่แก้ เราสามารถดู line ที่ขึ้น error ได้ ดู host แล้วใช้คำสั่ง ssh-keygen -R <host> เพื่อลบสะ