I have about 100 commits, and for SOME REASONS I want each one to be pushed seperately. I mean:
For example I have 1 branch named developing and this branch has 100 commits (for 1 week). I don't want to push all at once. I want git, to push the first commit, then pushes the second commit and so on, one after another. I know this might take a lot of internet and time, but I need it.
Any ideas? Or how can I write a script for it?
It's problem, as I painted, is that I can't see each commit in order. I have to open each push to see innter commit. It's bad.
"The second option" is on the Repository tab:
And this one, it's probelm is
- It doesn't show all commits.
- It doesn't show commits date-oredered. I have to select a branch. Let's imagine I was working on 8 branches this week. I must remember branch names to check them, plus they are not in order.
I want something like:
git log #git log --oneline --graph
Thanks.
CodePudding user response:
Your initial question is answered by this snippet :
git push origin 09a079fa26e0176f13c5423a47fefb2b860205d6:draft/testing-hot-dev-branch
git push origin afeeee97560ade9067bfb3f62243c3edf804fa54:draft/testing-hot-dev-branch
Indeed you can't do it manually like that if you have 100 commits to push, you will have to script it, and ensure all people of your team use your script. And you will have to be very carefull, pushing the commits in the wrong order or forgetting a commit could be problematic.
In my opinion, you'd better find a solution to the underlying problem. Moreover, it would also solve the 'past', when you pushed several commits at once in the past.
About the underlying problem (You can't find a way to see all your commits, ordered by date, in Gitlab Website), a solution could be to use the Graph view, all commits of all branches are displayed, in descending chronological order.
The interface is a little misleading because it's displayed 'main' in the top of the page, but concretely all branches are in the graph. The commit SHA and a few details can be seen if you put your mouse hover a point representing a commit, and the points are clickable.
NB1 : to produce this picture I used the commands below, you can see that I pushed my three commits in one push command :
$ git checkout -b draft/testing-hot-dev-branch origin/main
$ touch test1 && echo "1" > test1
$ git add test1
$ git commit -m "first commit"
$ touch test2 && echo "2" > test2
$ git add test2
$ git commit -m "second commit"
$ touch test3 && echo "3" > test3
$ git add test3
$ git commit -m "third commit"
$ git push --set-upstream origin draft/testing-hot-dev-branch
NB2 : if you look the XHR queries of this page, you also can see the graph in an exploitable JSON format (so I guess you can retrieve it via Gitlab API too)
NB3 : if you push all your 100 commits separately, a side effect will be that your pipelines will run 100 times instead of 1 time (don't know if in your context it's an advantage or an inconvenient, for me it's clearly an inconvenient)







