DEV Community

Discussion on: Top 5 Git Tips & Tricks

Collapse
 
michaelcurrin profile image
Michael Currin

I don't bother with the -p chunks in the terminal. VS Code and PyCharm do a great job and giving a neat UI for selecting a range of lines and staging those.

Also a time saver, if don't like git add, you can do this, which applies to named paths. If the file is untracked because it is new, you will have to use git add though.

# add and commit directory foo, bar and file.txt etc. Everything in current directory and below.
git commit .

# add and commit everything in foo/ and below
git commit foo/

# Target a file
git commit file.txt
git commit foo/file.txt

# Target files
git commit foo/ bar/*.js package*.json README.md about.md
Enter fullscreen mode Exit fullscreen mode