Difference between array_push() and $array[] =

When you call a function in PHP (such as array_push()), there are overheads to the call, as PHP has to look up the function reference, find its position in memory and execute whatever code it defines. Using $arr[] = ‘some value’; does not require a function call, and implements the addition straight into the data … Read more

fatal: The upstream branch of your current branch does not match the name of your current branch

This happens if the name of the upstream branch and local branch do not match, which sometimes happens, and usually is unwanted: > git status On branch release-1.2.3 Your branch is up to date with ‘origin/master’. To solve this, run: git branch –unset-upstream Then, once you run git push again, you will be asked to … Read more

Git Push into Production (FTP)

Some tools recently added to the Git wiki: git-ftp by RenĂ© Moser is a simple shell script for doing FTP the Git way. Use git-ftp.sh to upload only the Git tracked files to a FTP server, which have changed since the last upload. This saves time and bandwith. Even if you play with different branches, … Read more

Git push rejected “non-fast-forward”

It looks, that someone pushed new commits between your last git fetch and git push. In this case you need to repeat your steps and rebase my_feature_branch one more time. git fetch git rebase feature/my_feature_branch git push origin feature/my_feature_branch After the git fetch I recommend to examine situation with gitk –all.

Git: add vs push vs commit

git add adds your modified files to the queue to be committed later. Files are not committed git commit commits the files that have been added and creates a new revision with a log… If you do not add any files, git will not commit anything. You can combine both actions with git commit -a … Read more

Git – Ignore files during merge

I got over this issue by using git merge command with the –no-commit option and then explicitly removed the staged file and ignore the changes to the file. E.g.: say I want to ignore any changes to myfile.txt I proceed as follows: git merge –no-ff –no-commit <merge-branch> git reset HEAD myfile.txt git checkout — myfile.txt … Read more