0

I am doing an effort to learn Git using the terminal but I have to say I have not come far. So any help would be useful. I read this thread with my same problem (link) but I was not able to solve it. Additionally, I had another rookie question.

So here it goes. After installing git and doing the git config --user.name and --user.email I went to write git config --list to see what was pre-configured. I found all of this:

core.excludesfile=~/.gitignore
core.legacyheaders=false
core.quotepath=false
mergetool.keepbackup=true
push.default=simple
color.ui=auto
color.interactive=auto
repack.usedeltabaseoffset=true
alias.s=status
alias.a=!git add . && git status
alias.au=!git add -u . && git status
alias.aa=!git add . && git add -u . && git status
alias.c=commit
alias.cm=commit -m
alias.ca=commit --amend
alias.ac=!git add . && git commit
alias.acm=!git add . && git commit -m
alias.l=log --graph --all --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'
alias.ll=log --stat --abbrev-commit
alias.lg=log --color --graph --pretty=format:'%C(bold white)%h%Creset -%C(bold green)%d%Creset %s %C(bold green)(%cr)%Creset %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
alias.llg=log --color --graph --pretty=format:'%C(bold white)%H %d%Creset%n%s%n%+b%C(bold blue)%an <%ae>%Creset %C(bold green)%cr (%ci)' --abbrev-commit
alias.d=diff
alias.master=checkout master
alias.spull=svn rebase
alias.spush=svn dcommit
alias.alias=!git config --list | grep 'alias\.' | sed 's/alias\.\([^=]*\)=\(.*\)/\1\     => \2/' | sort
include.path=~/.gitcinclude
include.path=.githubconfig
include.path=.gitcredential
diff.exif.textconv=exif
credential.helper=osxkeychain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
user.name=myusername
user.email=“myemail”
user.name=“myname
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true

Now, in the link I send before it explains why everything is pre-configured but I was hoping to start with a clean slate and learn from the bottom. When I write: ls -a in the terminal, I find the .gitconfig file and the .git directory. What is the difference between these two? When I open the .gitconfig I find this

[filter "lfs"]
    clean = git-lfs clean -- %f
    smudge = git-lfs smudge -- %f
    process = git-lfs filter-process
    required = true
[user]
    name = myusername
    email = “myemail”
    name = “myname

When I go cd .git I find more files, amongst them config, when I open this one, this is what it shows.

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true

I do not want to make a mistake, on the post I mentioned before it says "You can just erase all of that and start clean if you want." What exactly do I need to erase? Everything?

I also had a small question that will make me look stupid but here it goes. When the terminal wants to show long lists I sometimes use the "down arrow" to see everything and sometimes it says "END" I try to press every button but I cannot go to "END" or just get out of there I can only press the escape button but then it says "ESC" and then blocked again. My rookie solution is close the terminal and start again. What should I do in these events?

enter image description here

Anyway, thanks for taking the time to read this!

JourneyDS
  • 113
  • 14
  • 1
    For future reference, it may be helpful to separate your combined question into two—there's no shame in asking basic questions as you start out, and asking the two questions separately might make it easier for future answerers and readers to find each part separately. Good luck in your `git` journey! – Jeff Bowman May 05 '20 at 00:48

1 Answers1

1

Git's configuration system is hierarchical: The system itself has a configuration (typically /etc/gitconfig), you have a configuration as a user (typically in ~/.gitconfig, the file in your home directory named .gitconfig), and each git repository you create individually has its own config file within its .git directory. This means that the system can have overall git settings, which you override individually, and then you can override those both in the individual repo you use. You can see the individual paths under the FILES sections of the git config help page.

If you want to see where those settings are configured, you can use git config --list --show-origin as in this question: How to find out which Git config file is used and how to override settings?. That question also goes into some detail about how those configuration hierarchy levels work.

Your question about (END) is related to a "pager", which is a program that runs that lets you use your cursor to interactively read a long document. Git uses pagers frequently by default, and you can which pager you use (or disable them entirely) through environment variables or the core.pager config. (See the git config docs.) A common default pager is called less, which has a helpful man page of its own, but the important part is that you can use the letter h to open up help and q to quit the program.

Jeff Bowman
  • 90,959
  • 16
  • 217
  • 251
  • Hi Jeff! First of all, thanks a lot for the detailed explanation. They have been very helpful. I will follow your advice and separate them into two queries in the future as you suggest! I only had three more questions I wanted to get your opinion on. I used the git config --list --show-origin command you mention. Apparently all the settings are being read from: /usr/local/git/etc/gitconfig . 1) Is it possible to edit this file? And is it recommended? 3) Is there a general rule to what level of the hierarchy it's recommended changing things "system", "global" or "local"? – JourneyDS May 05 '20 at 18:01
  • 1
    @JourneyDS You're welcome! (1) Yes, the file is human-editable, including with `git config --edit`; (2) I tend to like to use the `git config` commands when making one-off edits, to avoid syntax and type errors that `git config` might catch, but I'd happily copy/paste/erase/rename/backup/restore config syntax I know is good. (3) If you're the only person using your system, and you want roughly the same behavior on all your repos, it doesn't really matter and `--global` is often right. Be careful with `--system` on a shared computer, and use `--local` for per-repo overrides (e.g. email, crlf). – Jeff Bowman May 05 '20 at 18:13