Category Archives: Uncategorized

GIT CHECKOUT

Git checkout command is used to switch between different branches and to update the files in the working directory to match the versions stored in a specific branch or commit.

Here’s an example:

Suppose you are working on a branch called “feature-branch”, and you want to switch to the main branch. You can use the following command:

git checkout main

This command will switch you to the main branch. Now, let’s say you need to work on a specific commit in that branch. You can use the commit hash or ID to check out that version as follows:

git checkout 87a3cde

Here, 87a3cde is the commit ID you want to check out.

I hope that helps!

GIT PULL

git pull is a command in Git that fetches and merges changes from a remote repository to your local repository. This command is handy when working in a team that pushes code to a remote repository frequently.

Here’s an example:
Let’s say there are two branches in the remote repository main and feature. Your local repository is currently on the main branch. To update your local repository with the changes from the feature branch of the remote repository, you can use the following command:

git pull origin feature

This command will fetch changes from the feature branch of the remote repository origin and merge them into your local repository. If there are any conflicts between the changes in the remote repository and your local repository, you’ll need to resolve these conflicts before you can push your changes back to the remote repository.

GIT PUSH

git push is a Git command used to upload your local commits to a remote repository. It is used to push changes made to your local repository to a remote repository and update the remote repository’s branch with your local changes. Here is an example:

Let’s say you have made some changes to a local repository and committed those changes. Now, you want to push those changes to a remote repository on GitHub.

First, you need to add a remote repository to your local repository by using the command git remote add origin [remote repository URL].

Once you have added a remote repository, you can push your changes by running the command git push origin [branch name]. For example, if you want to push your changes to the master branch, you will run the command.

git push origin master

or simply

git push

This will upload your local changes to the remote repository’s master branch, making them available to others who are collaborating on the project.

GIT INIT

git init is a command in Git that creates a new Git repository. It sets up all the necessary files and directories that Git needs to begin tracking changes to your project. This command creates a new subdirectory named .git that contains all of the necessary repository files.

Here is an example:

Let’s assume you have a folder on your desktop named “project”. Open a terminal/command prompt in that directory and enter git init. This will create a new subdirectory named .git in your “project” folder.

$ cd ~/Desktop/project
$ git init
Initialized empty Git repository in /Users/USER/Desktop/project/.git/

This command only needs to be run once per repository. After running git init, you can start tracking changes to your project using Git commands like git add and git commit.

Symfony 2: Creating a Bundle

As discussed in this and this post, Symfony 2 is a web application framework. In Symfony 2 we organize our code in form of bundles. You can think bundle as collection of all code. Say if your app has a front-end, a back-end and an API then you can create three different bundles one for your front-end, one for your back-end and one for API. This will allow your to manage code efficiently.

Symfony 2 is flexible and it allows you to have as many as bundles you want in your app. Let’s understand this bundle system in detail by creating a bundle.

Continue reading Symfony 2: Creating a Bundle

Using Localhost For Facebook App Development

As a programmer you do develop every application on your machine first and then you test it on same machine and then you push it to remote test/production environment. You are developing a Facebook app and your requirement is user must login to use the app. Now you are ready with local environment, you have created a new project in your powerful IDE, you have downloaded the SDK, you are done with creating a new app in FB developer, now you are trying to add app domains to get access to FB’s oAuth API. Hmm….. Something went wrong!… Facebook is not allowing you to use ‘localhost’ as app domain. Now what to do? Here is solution.

Continue reading Using Localhost For Facebook App Development