I am fairly new to git and by now i know the basics. Even tho I use a plugin/program with a GUI to work with git in my daily work, I really like to know what is going on behind the scenes.
I am normally working in Intellij and there I am able to split my changes up in different 'changelists'.
As seen on the picture below I have a changelist with markdown files and a default changelist with script changes.
Here is a picture showing it:
I am wondering if the changelist is a concept in Git or just a concept made up in the Intellij plugin?
If it's a concept in Git, what is the commands needed in the command line?
Changelists are predating the integration of Git in IntelliJ IDEA, so they are a concept from IntelliJ, allowing you to split your changes in different sets.
I explained how they were linked to a Git commit in "What is a changelist in IntelliJ IDEA?".
Since there is only one index (staging area) in Git, there is no direct command-line equivalent.git stash
is a poor substitute, as long as you are using --keep-index
, in order to preserved the staged changed in your working tree.
I don't know how IntelliJ handles git internally, and git does not have a concept of different changesets, but something similar.
A commit does not commit your current working-directory but your staging area. You need to stage everything you want to have in your next commit first. This can be used to split work in multiple commits, you can stage files or even parts of a file (hunks). But there is only one staging area, so you can not really split your work in different changesets. Instead, you stage what you want to have in your commit, then commit, then repeat.
If you're working on something but need to stop your work on this feature and instead work on something different you can stash your changes. This stores your changes in a stashing-area and cleans your working-directory to the HEADs state. When you're done with your other change you can reapply the stored changes onto the working-dir and continue working on this feature.
Use Branches, Branches are good. Use lots of them, merge often. Create a branch for every feature you are working on and commit your changes. Switch to a different branch, work on something different. If a feature is finished, merge it to master (or your develop-branch or what not). Keep different things you're working on in different branches. This prevents you from breaking one part of your work when you half-finished another one which is still buggy.
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