Category Archives: Version control

Ignore file permissions with git

Description: Running a git status command shows modified files, with only changed file permissions. This can be due the IDE, for example PHPStorm is known for being a bit too nosy. diff –git a/myproject/index.php b/myproject/index.php old mode 100644 new mode 100755 … Continue reading

Posted in Version control | Tagged , , , , , | Leave a comment

Remove remote branch with GIT

Description: Having pushed a wrongly extended branch to origin, or you just don’t need to have a branch both locally and remote. Solution: Locally, deleting the branch was covered in a previous article. However, there are some cases that require … Continue reading

Posted in Version control | Tagged , , , , , | Leave a comment

Rename a branch with Git

Description: We need to rename a branch using Git. Solution: This works of course only on local branches, but it should be enough. git branch -m <current_name> <nnew_name> You don’ need to change branch in order for this to work. … Continue reading

Posted in Version control | Tagged , , , | Leave a comment

Edit a commit message with GIT

Description: Having that we commited some code with a wrong message, how can we edit the last commit? Solution: If the code has not been pushed yet, the command git commit –amend will do the trick. Example : git commit –amend -m … Continue reading

Posted in Version control | Tagged , , , , , | Leave a comment

Basic Git branch operations: create, update, delete

Description: Basic Git version control operations regarding branches. Solution: Create branch: >git checkout -b branches/new_branch Fetch changes: >git fetch Update branch/branches: >git pull >git pull origin branches/new_branch Delete branch: >git branch -D branches/new_branch

Posted in Best practices, Tools, Version control | Tagged , , , , , | 1 Comment

GIT Merge branches

Description: After finishing work on a branch we need to merge it to the original project or with another branch Solution: Checkout and pull main branch. Second, checkout the working branch. Run the merge command on the working branch: > … Continue reading

Posted in Tools, Version control | Tagged , | Leave a comment

GIT Create new branch from clean environment

Description: Create a new branch from GIT command line Solution: Start with a clean environment: > git status Checkout main branch: > git checkout –track origin/<Branchname> > git pull Create and switch to the new branch: > git checkout -b … Continue reading

Posted in Tools, Version control | Tagged | Leave a comment