How do I…
Short answers to the questions that come up while you work.
- How do I undo my last commit? Change it, or take it apart — and which you want depends on whether you have pushed.
- How do I stage only part of a file? Use the diff gutter: a hunk, a line, or a dragged block.
- How do I change a commit message? The last one can be amended. Older ones are a rewrite.
- How do I find a commit that has disappeared? Look in the reflog: Git remembers every position every branch has held.
- How do I see who changed a line? Blame the file, then walk back through the commits under it.
- How do I move a change to another branch? If it is uncommitted, stash it. If it is committed, cherry-pick it.
- How do I get back a file I deleted? If it was committed, it is in the history. If it was not, it may be in Recovery.
- How do I ignore a file that is already committed? Adding it to .gitignore is not enough — Git keeps tracking what it already tracks.
- How do I work on two things at once? Two windows, two repositories — or one repository, and a stash between them.
- How do I see what I am about to push? Push previews it. So does comparing your branch with its remote.
- How do I rename a branch? Locally, in place. The remote keeps the old name until you deal with it.
- How do I tidy up my branch before a review? Rebase onto the target branch, and consider squashing when you merge.
- How do I resolve a conflict in my favour? Accept ours — but check what you are discarding first.
- How do I remove a repository from the Projects list? Remove the entry. It deletes nothing.
- How do I open a repository from the terminal? Install the innesta command from Settings, then type it.
- How do I use a different name or email for one repository? Set it in that repository's own Git config; Innesta uses whatever Git resolves.
- How do I compare my branch with main? Select the two tips and compare them, or scope the history to each in turn.
- How do I abandon a merge or a rebase? Stop it. The repository goes back to where it started.
- How do I sign my commits? Configure the key in Git; the toggle in the commit panel follows it.
- How do I see a file as it was in an old commit? Open the commit, select the file, and widen the diff context to the whole file.