1. In classical Git Flow, which branches are long-lived?
Git Flow uses persistent main and develop branches; feature/release/hotfix are short-lived.
Get the Preplance app for a seamless learning experience. Practice offline, get daily streaks, and stay ahead with real-time interview updates.
Get it on
Google Play
4.9/5 Rating on Store
LTIMindtree · Git & Version Control
Practice Git & Version Control questions specifically asked in LTIMindtree interviews – ideal for online test preparation, technical rounds and final HR discussions.
Questions
30
Tagged for this company + subject
Company
LTIMindtree
View company-wise questions
Subject
Git & Version Control
Explore topic-wise practice
Go through each question and its explanation. Use this page for targeted revision just before your LTIMindtree Git & Version Control round.
Git Flow uses persistent main and develop branches; feature/release/hotfix are short-lived.
For complete preparation, combine this company + subject page with full company-wise practice and subject-wise practice. You can also explore other companies and topics from the links below.
This ties the current local branch to a remote tracking branch for pull/push defaults.
Stage the resolved files and continue. You do not create a manual commit during rebase steps.
A fast-forward moves the branch pointer when no divergent commits exist; no merge commit is created. `--no-ff` forces a merge commit to preserve feature-branch context—useful for code review traceability and keeping logical units in history.
Use `git switch -c feature origin/feature` or `git checkout --track origin/feature`. This sets upstream so pulls/pushes use the remote branch by default.
Reflog records movements of HEAD and refs (even orphaned). It’s crucial for recovering "lost" commits after resets/rebases or branch deletions.
Modern syntax uses `git stash push -m "message"` to label the stash.
`pop = apply + drop`. Use `apply` to reuse later, `pop` to consume once.
`git worktree add ../path <branch>` creates another working tree tied to the same `.git` data, enabling parallel checkouts.
An upstream branch is the remote branch your local branch integrates with by default for pull/push. Set it via `git branch --set-upstream-to=origin/main` or on first push using `git push -u origin <branch>`.
Use `-d` for safe deletion (already merged). `git fetch --prune` cleans stale remote-tracking refs.
`--no-ff` creates a merge commit even if HEAD could fast-forward, keeping branch context for later tracing/reverts.
Threat-aware review plus automated secret scanning and SCA improves security posture.
`git add` places changes into the index (staging area), a buffer where you curate what will go into the next commit.
Tag fixups (`fixup! subject`) then run interactive rebase with `--autosquash`.
Pushing a specific tag uses `git push <remote> <tag>`; `--tags` pushes all tags.
Conventional Commits use type(scope?): subject — e.g., feat, fix, chore, docs — aiding automation and changelogs.
Use `git reflog` to find the previous HEAD (e.g., `HEAD@{2}`) then `git branch rescue HEAD@{2}` or `git reset --hard <that-id>` to restore the state.
`revert` adds a new commit that negates a past one; safe for shared branches.
Valid format: MAJOR.MINOR.PATCH-PRERELEASE+BUILD; leading 'v' is not part of SemVer core.
Use it to fix the last commit’s message or add missed changes. It rewrites history, so avoid amending commits already pushed/shared.
`A..B` shows commits reachable from B and not A; `...` is symmetric difference.
Set at repo scope with `git config pull.rebase true` (or `--global` for all repos).
Enable with `git config rerere.enabled true` to speed repeated merges/rebases with identical conflicts.
Keep subject line ≤50 chars in imperative mood (e.g., "Fix crash on null input"). Add a blank line, then a body explaining what and why (context, impact, links).
Rewriting history creates new commits; force-push would be required and can disrupt collaborators.
Smaller diffs are easier to review thoroughly and roll back when needed.
Fetch updates, then hard-reset branch to the remote tip (tracked files).
`--rebase` linearizes history by replaying local commits over the updated upstream.
Rebase+merge rewrites branch commits on top of base to keep history linear.