How can I see which Git branches are tracking which remote / upstream branch?

Very much a porcelain command, not good if you want this for scripting: Note that with git 1.8.3, that upstream branch is displayed in blue (see “What is this branch tracking (if anything) in git?“) If you want clean output, see arcresu’s answer – it uses a porcelain command that I don’t believe existed at the time I originally … Read more

What’s the use of the staging area in Git?

There are many uses of staging in Git. Some are listed below: staging helps you split up one large change into multiple commits – Let’s say you worked on a large-ish change, involving a lot of files and quite a few different subtasks. You didn’t actually commit any of these — you were “in the zone”, … Read more

How can I unstage my files again after making a local commit?

git reset –soft HEAD~1 should do what you want. After this, you’ll have the first changes in the index (visible with git diff –cached), and your newest changes not staged. git status will then look like this: You can then do git add foo.java and commit both changes at once.

How to permanently remove few commits from remote branch

You git reset –hard your local branch to remove changes from working tree and index, and you git push –force your revised local branch to the remote. (other solution here, involving deleting the remote branch, and re-pushing it) This SO answer illustrates the danger of such a command, especially if people depends on the remote … Read more

Git keeps prompting me for a password

I think you may have the wrong Git repository URL. Open .git/config and find the [remote “origin”] section. Make sure you’re using the SSH one: You can see the SSH URL in the main page of your repository if you click Clone or download and choose ssh. And NOT the https or git one: You can now validate with just the SSH key instead of the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)