github skills?

Ian Bruntlett ian.bruntlett at gmail.com
Sun Jan 28 16:06:43 UTC 2024


Hi Bruce,

On Sun, 28 Jan 2024 at 15:43, bruce <badouglas at gmail.com> wrote:

> Perhaps a bit off topic. Getting familiar with github/git/gh. Setting
> up a test scenario, walking through the different cmds, etc.
>
> Wondering if anyone in/on the list has github skills and a few mins to
> play to play email/github guru/mentor!
>
> Hey, it's Sunday, maybe you're bored!
>

I, too, am learning Git - via the O'Reilly book "Learning Git". I have some
confidence with working with local repositories.

Some pointers for you:
* Install the git-doc package. Amongst other things it provides the user
manual (which can also be found online: https://git-scm.com/docs/user-manual
)
* Install the gitk package. The gitk command provides a GUI to browse the
local repository that it was started from.
* Install the git-gui package. The git gui command provides a GUI for many
aspects of Git.
* The book Pro Git (2nd Edition) is available online:
https://git-scm.com/book/en/v2 but I haven't read it yet.

I have a shell script, greatly improved by help on the accu-general email
mailing list which sets the command prompt to show information about the
repository that I am in.

Simply copy the script somewhere convenient for you and invoke it with the
"." command. Something like

. path/to/file/git-prompt.sh

or the alternative

source path/to/file/git-prompt.sh

Here it is (you don't have to call it git-prompt.sh, you can call it
anything you want):

# Usage
# . ~/git-prompt.sh

# Initially borrowed from:
#
https://git-scm.com/book/en/v2/Appendix-A%3A-Git-in-Other-Environments-Git-in-Bash
# See also
https://github.com/git/git/blob/master/contrib/completion/git-completion.bash

# unstaged (*) and staged (+) changes will be shown next to the branch
# name.  You can configure this per-repository with the
# bash.showDirtyState variable, which defaults to true once
# GIT_PS1_SHOWDIRTYSTATE is enabled.
export GIT_PS1_SHOWDIRTYSTATE=1

# You can also see if currently something is stashed, by setting
# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,
# then a '$' will be shown next to the branch name.
export GIT_PS1_SHOWSTASHSTATE=1

# If you would like a colored hint about the current dirty state, set
# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
# the colored output of "git status -sb" and are available only when
# using __git_ps1 for PROMPT_COMMAND or precmd in Bash,
# but always available in Zsh.
export GIT_PS1_SHOWCOLORHINTS=1

# If you would like to see if there're untracked files, then you can set
# GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked
# files, then a '%' will be shown next to the branch name.  You can
# configure this per-repository with the bash.showUntrackedFiles
# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is
# enabled.
export GIT_PS1_SHOWUNTRACKEDFILES=1

# If you would like __git_ps1 to do nothing in the case when the current
# directory is set up to be ignored by git, then set
# GIT_PS1_HIDE_IF_PWD_IGNORED to a nonempty value. Override this on the
# repository level by setting bash.hideIfPwdIgnored to "false".

# Jonathan Wakely <accu at kayari.org> wrote:
# I use my own custom bash prompt that works in huge Git repos.
# The "official" git-prompt.sh is much too slow for the GCC repo (at least
last
# time I tried it). Mine caches the status between commands, and uses
different
# characters to show the branch status relative to upstream.
# That's at
https://gitlab.com/miscripts/miscripts/-/blob/master/profile.d/git-prompt.bash?ref_type=heads

export PS1='\w$(__git_ps1 " (%s)")\$ '


-- 
-- ACCU - Professionalism in programming - http://www.accu.org
-- My writing - https://sites.google.com/site/ianbruntlett/
-- Free Software page -
https://github.com/ian-bruntlett/TECH-Manuals/blob/main/tm-free-software.md
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20240128/a38d6a61/attachment.html>


More information about the ubuntu-users mailing list