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 – 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

What are the differences between “git commit” and “git push”?

Basically git commit “records changes to the repository” while git push “updates remote refs along with associated objects“. So the first one is used in connection with your local repository, while the latter one is used to interact with a remote repository. Here is a nice picture from Oliver Steele, that explains the git model … Read more

Array.push() if does not exist?

For an array of strings (but not an array of objects), you can check if an item exists by calling .indexOf() and if it doesn’t then just push the item into the array: var newItem = “NEW_ITEM_TO_ARRAY”; var array = [“OLD_ITEM_1”, “OLD_ITEM_2”]; array.indexOf(newItem) === -1 ? array.push(newItem) : console.log(“This item already exists”); console.log(array)

Push Notifications when app is closed

Yes, it is possible ‘to receive notifications from google cloud message when the application is fully closed’. Infact, A broadcast receiver is the mechanism GCM uses to deliver messages. You need to have implement a BroadcastReceiver and declare it in the AndroidManifest.xml. Please refer to the following code snippet. AndroidManifest.xml <receiver android:name=”.GcmBroadcastReceiver” android:permission=”com.google.android.c2dm.permission.SEND” > <intent-filter> … Read more

How can I push a specific commit to a remote, and not previous commits?

To push up through a given commit, you can write: git push <remotename> <commit SHA>:<remotebranchname> provided <remotebranchname> already exists on the remote. (If it doesn’t, you can use git push <remotename> <commit SHA>:refs/heads/<remotebranchname> to autocreate it.) If you want to push a commit without pushing previous commits, you should first use git rebase -i to … Read more