Sometimes I work on system without X Window installed, and can't use Git GUI.
What are existing console alternatives to the git add -p
?
I like almost everything that it does (more than Git GUI actually), but I hate that it does not let me view the whole picture and choose the order that I want to review the chunks. That's the only actual advantage of Git GUI over git add -p
to me, but it is rather crucial one.
I tried tig
, but I do not like the user experience that it offers.
Any suggestions?
The git add command adds new or changed files in your working directory to the Git staging area. git add is an important command - without it, no git commit would ever do anything. Sometimes, git add can have a reputation for being an unnecessary step in development.
Detail: git add -A is equivalent to git add .; git add -u . The important point about git add . is that it looks at the working tree and adds all those paths to the staged changes if they are either changed or are new and not ignored, it does not stage any 'rm' actions.
The git add command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit. However, git add doesn't really affect the repository in any significant way—changes are not actually recorded until you run git commit .
Vim has a plugin 'fugitive'
Edit: the linked vimcast (comments) is excellent and I recommend it. I would like to add the hint that there will normally not be a need to type :diffget
and :diffput
in longhand, because you can do he same directly in normal/visual mode by pression do and dp.
The best command to start with for this feature appears to be :Gstatus
Vim is a terminal editor (which so happens to have a gui port too)
The fugitive plugin will simply let you edit the index and worktree versions of files alongside each other and let you diffput/diffobtain until you're satisfied. Vim's diff mode is sophisticated, and much more flexible/intuitive than git add --patch
.
You can get fugitive here
Snippet from :he fugitive
:
Edit a file in the work tree and make some changes. Use |:Gdiff| to open up the indexed version. Use |do| and |dp| on various hunks to bring the files in sync, or use |:Gread| to pull in all changes. Write the indexed version to stage the file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With