Finding diff between current and last version

I don’t really understand the meaning of “last version”. As the previous commit can be accessed with HEAD^, I think that you are looking for something like: git diff HEAD^ HEAD That also can be applied for a :commithash git diff $commithash^ $commithash As of Git 1.8.5, @ is an alias for HEAD, so you … Read more

Pull a certain branch from the remote server

But I get an error “! [rejected]” and something about “non fast forward” That’s because Git can’t merge the changes from the branches into your current master. Let’s say you’ve checked out branch master, and you want to merge in the remote branch other-branch. When you do this: $ git pull origin other-branch Git is … Read more

How can I pull/push from multiple remote locations?

Doing this manually is no longer necessary, with modern versions of git! See Malvineous‘s solution, below. Reproduced here: git remote set-url origin –push –add <a remote> git remote set-url origin –push –add <another remote> Original answer: This something I’ve been using for quite a while without bad consequences and suggested by Linus Torvalds on the … Read more

Finding what branch a Git commit came from

While Dav is correct that the information isn’t directly stored, that doesn’t mean you can’t ever find out. Here are a few things you can do. Find branches the commit is on git branch -a –contains <commit> This will tell you all branches which have the given commit in their history. Obviously this is less … Read more

Make the current commit the only (initial) commit in a Git repository?

Here’s the brute-force approach. It also removes the configuration of the repository. Note: This does NOT work if the repository has submodules! If you are using submodules, you should use e.g. interactive rebase Step 1: remove all history (Make sure you have a backup, this cannot be reverted) cat .git/config # note <github-uri> rm -rf … Read more

How do I prevent ‘git diff’ from using a pager?

–no-pager to Git will tell it to not use a pager. Passing the option -F to less will tell it to not page if the output fits in a single screen. Usage: git –no-pager diff Other options from the comments include: # Set an evaporating environment variable to use ‘cat’ for your pager GIT_PAGER=cat git … Read more

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