![]() ![]() If HEAD points directly at a commit the situation is called detached HEAD. This is essentially how Git knows which branch is being worked on. Typically HEAD will point at a branch, which then points at a commit. The HEAD is a special pointer representing the commit being worked on currently, like the tip in Mercurial. That branches are just pointers is one of the most important realizations to make when learning Git coming from Mercurial. The individual commits keep no record off what branch they belonged to when they were made. It points at the tip of the branch and Git will move it along when adding commits to the branch. Commits are typically referenced in the command line by the first 7 characters of the SHA hash.Ī branch is nothing more than a pointer to a commit with a name. In Git, commits are basically snapshots of the working tree files identified by a SHA-1 hash with a bit of metadata like parent commit pointers. To see all the currently visible configuration values try: git config -list 2. In this article there will be several suggested command aliases, read on. They can turn long commands into much shorter commands by string substitution. Note that doing this will store the login including password in plaintext in the file /home//.git-credentialsĪnother very convenient class of configuration values is command aliases. ![]() git config -global credential.helper store.Doing this will make Git store the entered username and password when pulling or cloning a repository so the login information doesn't have to be typed in again: If planning to synchronize with remote repositories, it is very helpful to enable the credentials store. Git uses this editor for editing commit messages: git config -global user.email may be helpful to change the default text editor.git config -global user.name "My name".Git needs a username and email to use as the author of commits. To set a setting locally change directory to the repository root and run the commands without -global. In the following examples the settings are set globally for the user. Git configuration options can be set locally for a repository, globally for a user or even system wide. This guide assumes a Linux-like system with Git installed. It will also unlock a lot of powerful operations. Mastering Git from the command line is an essential step to start enjoying it and will make using any odd GUI more tolerable afterwards. Version control may seem like something eminently better done with a helpful GUI.īut in Git you just have to loose this idea. My recommendation is to learn these techniques anyway and try them out before deciding whether to use them or not.īeing spoiled with TortoiseHg workbench may mean never having been forced to do version control management from the command line. In Git it's common to rewrite history to clean up commits, while in Mercurial land rewriting history would be frowned upon. There are some philosophical differences to be aware of also. To enjoy using Git it is really important to take this seriously and spend the mental effort required to learn how Git works. Git is similar in many ways to Hg, but still quite different. Take the time to actually learn how Git works.There is nothing out there that will to that, and nothing will be exactly like TortoiseHg. My thinking was that since Git was so prevalent someone must have made a brilliant free GUI that will make everything obvious, so I wouldn't have to spend time and energy to learn the nitty gritty details of the Git command line. Stop looking for a GUI that matches TortoiseHg workbench.You may want to follow a Git getting started tutorial in parallel with reading this. Note that this is not written for total Git beginners. There is no free GUI for Git that match the power and ease of use of TortoiseHg workbench, and some terms in Git just annoy hg users to no end, like what exactly a pull is supposed to do.īut there is hope, of course, and in this article I will explain key concepts that I found important to understand properly coming from Hg, and you will find some hints to make the Git experience more smooth. Using Git as an experienced hg / Mercurial user can be frustrating. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |