DayToDayDevOpsCourse / GitHub

1 stars 10 forks source link

Is selective commit possible while pushing? #1

Open venkatasykam opened 6 years ago

venkatasykam commented 6 years ago

For example, I committed my changes in 10 files. First I have committed with 5 files changes only. Committed again with the rest of the 5 files. Git created two commit-ids for each commit.

Assume: Commit-id for 1st commit: 0jkuo98k Commit-id for 2nd commit: tr5tyh76i

Now, I just want to commit only the first commit-id.

Can anyone help with this scenario?

Thanks

venkatasykam commented 6 years ago

Ans is:

Syntax: git push origin :

Ex: git push origin 0jkuo98k:

(You did not mention the branch, replace your branch name in the above example).

Note: But this is not recommended approach. Because, if someone pushed his commits, while you push your second commit will be merged with others. Unnecessary a merge commit created. This will create a confusion to the dev team.