git checkout all the files

If you are at the root of your working directory, you can do git checkout — . to check-out all files in the current HEAD and replace your local files. You can also do git reset –hard to reset your working directory and replace all changes (including the index).

Import existing source code to GitHub

If you’ve got local source code you want to add to a new remote new git repository without ‘cloning’ the remote first, do the following (I often do this – you create your remote empty repository in bitbucket/github, then push up your source) Create the remote repository, and get the URL such as [email protected]:/youruser/somename.git or https://github.com/youruser/somename.gitIf your local … Read more

Create empty branch on GitHub

November 2021 Update: As of git version 2.27, you can now use git switch –orphan <new branch> to create an empty branch with no history. Unlike git checkout –orphan <new branch>, this branch won’t have any files from your current branch (save for those which git doesn’t track). This should be the preferred way to create empty branches with … Read more

What’s a good (free) visual merge tool for Git? (on windows)

On Windows, a good 3-way diff/merge tool remains kdiff3 (WinMerge, for now, is still 2-way based, pending WinMerge3) See “How do you merge in GIT on Windows?” and this config. Update 7 years later (Aug. 2018): Artur Kędzior mentions in the comments: If you guys happen to use Visual Studio (Community Edition is free), try the tool that is shipped with it: vsDiffMerge.exe. It’s … Read more

I use SourceTree with Git but need to work with SVN repistory, what options do I have?

If those opensource projects are no longer active in their Subversion referential, you could: clone them locally (you can use TortoiseSVN for example) use SubGit to make a one-time conversion between the local SVN repository and a new local Git repository. push the new Git repository to a new upstream repository hosting service. But if the SVN repository … Read more

Updating and committing only a file’s permissions using git version control

By default, git will update execute file permissions if you change them. It will not change or track any other permissions. If you don’t see any changes when modifying execute permission, you probably have a configuration in git which ignore file mode. Look into your project, in the .git folder for the config file and you should see something … Read more

What exactly does the “u” do? “git push -u origin master” vs “git push origin master”

The key is “argument-less git-pull”. When you do a git pull from a branch, without specifying a source remote or branch, git looks at the branch.<name>.merge setting to know where to pull from. git push -u sets this information for the branch you’re pushing. To see the difference, let’s use a new empty branch: First, we push without -u: remote = <nickname> … Read more

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